I just updated Cygwin and the new .bashrc contains this line right at the top:

echo "BEFORE TEST"
# If not running interactively, don't do anything
[[ "$-" != *i* ]] && return
echo "AFTER TEST"

I understand if not running interactive, you dont need to do anything, but my problem is that if i ssh with a command:

ssh localhost pwd

I see this:

BEFORE TEST

So, obviously, it fails the [[ "$-" != *i* ]] test and returns. Obviously ssh localhost pwd is a trivial example, but I expect .bashrc to be run all the way through if running a command through ssh. My actual automation runs commands remotely against this cygwin instance and is failing because the path (which is set by my .bashrc) is not getting set correctly.

Furthermore, can anyone explain what that test is actually doing? What is i? What is $- supposed to represent?

link|improve this question
This is probably better suited the the U+L SE site. – SmallClanger Feb 8 at 10:49
@SmallClanger, wow, i only knew about the 3 (stackovervlow, superuser, serverfault)... Anyway, I will repost there, thanks. – Lucas Feb 9 at 15:34
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.