-
To see what shell you are currently using
echo $0
-
When running a command that requires sudo but you want your alias to load add following alias to your .bashrc
alias sudo='sudo '
Note the space, this will force sudo to run in context of current .bashrc
-
How to SSH within a bash script, just add your commands you want to send wrapped in quotes
ssh user@server "ls -la | grep -i somevalue"
-
How to send command for remote system to use certain shell, example bash:
ssh user@server bash -c "ls -la | grep -i somevalue"
-
How to ssh multiple servers in a bash script while loop.
If in a while loop reading from a file and trying to ssh, ssh reads from stdin which is being used for read line.
To work around this use -n flag with ssh to tell it NOT to read from stdin
ssh -n user@server bash -c "ls -la | grep -i somevalue"