A login shell is one whose first character of argument zero is a -
, or one started with the --login
option. An interactive shell is one started without non-option arguments and without the -c
option.
Basically, when login from a tty you get an interactive login shell. When opening a terminal from within X, you get just an interactive shell.
The last type of shell, is the shell you get within a script.
-
/etc/profile
and then, in order of precedence, just the first readable file found is executed:
-
~/.bash_profile
-
~/.bash_login
-
~/.profile
-
~/.bash_logout
Delete to end of line |
|
Delete to start of line |
|
Delete to start of word |
|
Delete to end of word |
|
Go to the start |
|
Go to the end |
|
Go to next word (forward) |
|
Go to previous word (backward) |
|
Aliases is an easy way to alias commands to keywords. For instance:
alias ll='ls -al'
But aliases cannot accept arguments. A workaround is to define as alias a function and invoke it:
alias sshls='function _sshls() { ssh $1 "ls -al";};_sshls'
and with sshls hostname
the output of ls -al
on the remote host is displayed.
To exit script on error add the following:
set -e
In case of a command that returned non-true (0), script execution is stopped.
To exit your script if you try to use an uninitialised variable add the following:
set -u