Tech Articles
UNIXBasic Definition of Shell Scripting is Storing Frequently Used Commands in Files.
Store the following in a file named simple.sh and execute it.
#!/bin/sh# Generate some useful info for# use at the start of the daydatecallast $USER | head -6
Shows current date, calendar, and a six of your previous logins for security check. You might run this at the beginning of each day.Notice that the commands themselves are not displayed, only the results.To display the commands verbatim as they run, execute with sh -v simple.sh.
To echo the commands after variable translation, execute with sh -x simple.sh
With -v or -x (or both) you can easily relate any error message that may appear to the command that generated it
When an error occurs in a script, the script continues executing at the next command Verify this by changing 'cal' to 'caal' to force an error, and then run the script again Run the 'caal' script with 'sh -v simple.sh' and 'sh -x simple.sh' and verify the error message comes from cal
Now you can re-use commands easily and save some typing and mistakes
|
The training materials is very limited. It would be a great resource site if Training section is given a little more structured organisation. Just a thought from a user pov. Thx, Prashant |
|
Thanks Prashanth for your comments. We have added a new section EFS Directory with all the ebooks and tuturials for most of the topics. Thanks for your comment. |