Debian Codegraph @

erase.sh

raw symbols SCIP
1 #!/bin/bash
2 # erase.sh: Using "stty" to set an erase character when reading input.
3
4 echo -n "What is your name? "
5 read name # Try to backspace
6 #+ to erase characters of input.
7 # Problems?
8 echo "Your name is $name."
9
10 stty erase '#' # Set "hashmark" (#) as erase character.
11 echo -n "What is your name? "
12 read name # Use # to erase last character typed.
13 echo "Your name is $name."
14
15 exit 0
16
17 # Even after the script exits, the new key value remains set.
18 # Exercise: How would you reset the erase character to the default value?