Bash functions from the command line

bash

If you are going to execute a number of commands repeatedly, why not create a bash function from the command line to do the trick.

hostname:$ function_name () { cmd1; cmd2; cmd3; }

Note here that the last ";" after cmd3 is important. If you don't end the last command with a semicolon you'll get an error.

To remove the function, just unset it.

hostname:$ unset -f function_name

Comments powered by Disqus

Copyright 2010. All Rights Reserved.