scp bind warning

when there are bind commands in the .bashrc of the machine that you transfer files to with scp, scp will complain

bind: warning: line editing not enabled

instead of putting the offensive commands into the .bash_profile (which means that they are not executed at all when you are opening a non-login shell), a better solution seems to be to check whether there is a terminal:

1
2
3
4
5
case "$TERM" in
xterm*|rxvt*)
    bind .....
    ;;
esac

found on http://ubuntuforums.org/showpost.php?p=11270810&postcount=14

4 Responses to “scp bind warning”

  1. hq says:

    I would not restrict the TERM to anything by doing:

    if [ ! -v TERM ]; then
    bind…
    fi

  2. Sebastian says:

    That didn’t work for me; I found the following though which works:

    case “$-” in
    *i*)
    bind …..
    esac

  3. Alexander Swen says:

    Hi, A useful tip! thanx a lot. I searched for this solution as I had the sourcing of bash_bindings before:

    [ -z “$PS1” ] && return

    which stops processing .bashrc entirely when not started in a shell. See https://github.com/aswen/dotfiles/commit/30229c061ed62a229777f56f9c0fa6a7e5d64da5

  4. stork says:

    if [[ $- =~ i ]]; then
    bind …
    bind …
    fi

Leave a Reply