This blog covers Unix system administration HOWTO tips for using inline for loops, find command, Unix scripting, configuration, SQL, various Unix-based tools, and command line interface syntax. The Unix OS supports tasks such as running hardware, device drivers, peripherals and third party applications. Share tips/comments. Read the comments. But most importantly: Read Disclaimer - Read Disclaimer.

Tuesday, March 06, 2007

Create a Shell Function via the Command Line

On occasion we create shell functions on the command line to facilitate system administration tasks. Their clear advantage is speed because they are stored in a computer's main memory. These functions can also be setup in a script file or in a .profile file.

Here's an example.#currentusers{dateecho Users currently on the systemwho}

Displays the the users who are currently logged on#currentusers

To unset the function#unset currentusers

And here's one more example.#pingtest{datefor i in 1 2 3 4 5doping wkstn$idoneecho pingtest done}

Lists

Feeds

Feedburner

Disclaimer

If you use these tips, the author is not responsible for any adverse effects to your platform. Use these tips at your own risk. Do your own due diligence! These tips are intended as general guidelines and may vary from platform to platform. These tips are not the opinion of any vendor, and the author IS NOT associated/endorsed by any vendor. The author does not endorse any vendor.