Extending your bash shell with aliases, functions and extra commands
Archive - Originally posted on "The Horse's Mouth" - 2015-11-28 08:54:31 - Graham EllisWant a command to do some composite job, but it doesn't exist? You can add new commands into your bash script using
functions ... see example [here] from last week's course.
aliases ... here are the aliases that I'm using to provide my own extra / modified commands on our web server:
-bash-4.1$ alias
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias pd='pushd'
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
-bash-4.1$
another script ...
adding executables ...
Shell programming is so much about bolting together other programs and utilities - and they can include other shell programs as well as code in other languages. Paramaters can be passed in from the command line, data from STDIN, and from the environment - remember to use export if you want a shell variable / environmet variable to be shared with something you're running from your script.