shopt -s expand_aliases ttmp="SUCCESS" alias aliased_command='echo $ttmp'
I can use alias remotely by adding the above lines to .bashrc file.
[USER@REMOTESERVER ~]$ ssh MYSERVER aliased_command SUCCESS
Aliases are not expanded when the shell is not interactive, unless the expand_aliases shell option is set using shopt
expand_aliases option allows for non-interactive shells to use aliases.
However, when I run:
[USER@REMOTESERVER ~]$ ssh MYSERVER echo $- himBH
it seems that running a remote command through ssh is using an interactive shell.(
i is contained)
Is this right?
If right, why does this need expand_aliases option?
If wrong, if
ssh SERVER COMMAND uses a non-interactive shell, why does
ssh MYSERVER COMMAND read
.bashrc file of MYSERVER when a non-interactive shell doesn't read
cf) quoting command results a different output
[USER@REMOTESERVER ~]$ ssh MYSERVER 'echo $-' hBc
Any link, comment appreciated.