Following some issues with scp (it did not like the presence of the bash bind command in my .bashrc
file, apparently), I followed the advice of a clever guy on the Internet (I just cannot find that post right now) that put at the top of its .bashrc
file this:
[[ ${-#*i} != ${-} ]] || return
in order to make sure that the bash initialization is NOT executed unless in interactive session.
Now, that works. However, I am not able to figure how it works. Could you enlighten me?
According to this answer, the $-
is the current options set for the shell and I know that the ${}
is the so-called "substring" syntax for expanding variables.
However, I do not understand the ${-#*i}
part. And why $-#*i
is not the same as ${-#*i}
.