You can also use one of these methods:
, for Sequential executionchaining a sequence of commands, one after another:
- Sequential execution, one after another:
alias1 && alias2
Simultaneous execution, in background:
The && makes it only execute subsequent commands if the previous returns successful.
- Simultaneous execution, in background:
alias1 & alias2 &
As a one liner:
- As a one liner:
alias1; alias2
For chaining a sequence of commands, try this:
alias x='command1;command2;command3;'Or you can do this:
alias x='command1 && command2 && command3'The && makes it only execute subsequent commands if the previous returns successful.
Also for entering passwords interactively, or interfacing with other programs like that, check out expect. (http://expect.nist.gov/)...
Multiline alias in Bash
alias thing='(
cd "${program_to_update_dir}"
wget "https://raw.githubusercontent.com/USER/PROJECT/BRANCH/update.sh"
source update.sh
rm update.sh
)'
Shell functions may be define in the same initialization file that you define aliases in, and they are used in the same way as aliases, but are more versatile (can take arguments etc.) ...