0

When i use select loop to create a list of options, if i make a mistake during the prompt and want to hit backspace, it doesnt erase the character but displays ^H instead of it.

I know in "read" i can use -e to resolve this, but what do i do in select loop? Also, CTRL+C to break out of loop doesn't work. I've created select loop to loop through directories on remote side in menu-like style. It will change directory if directory is selected, but if it's not directory, it will select it as a file to edit.

until [[ $DONE == Yes ]]; do
select dir in $(ssh auth1 ls $PUTANJA $ONLYARPA) Nazad; do
        case $dir in
                "Nazad")
                        if [ "$PUTANJA" == "/var/named/chroot/var/named/master" ]; then
                                return
                        else
                                PUTANJA=$(ssh auth1 "cd $PUTANJA; cd ..; pwd")
                        fi
                        ;;
                *)
                        if ssh auth1 "[ -d $PUTANJA/$dir ]"; then
                                PUTANJA=$PUTANJA/$dir
                        else
                                ZONA=$dir
                                DONE=Yes
                        fi
                        ;;
        esac
        break
done
done
0

If your terminal is displaying ^H when you press the Backspace key, chances are your terminal has set the backspace sequence to a different character from what which you are sending. One of the other most common Backspace characters is ^?. Try pressing Ctrl+?. But a more useful solution would be to ensure that your terminal settings match your expectations (and inputs).

1
  • Thing is, unless i run a "select" loop, terminal is responding just fine when i use backspace. I'm on Fedora and i use standard Gnome Terminal. If the problem is actually with terminal, how come it works fine on everything else but "select" loop? I just tried changing "Backspace Key Generates" from Control+H to "Automatic" on gnome-terminal, seems to work fine for now! So thank you ! But still amuses me why it comes up only during select loop – Marko Todoric Apr 10 '19 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.