We write scripts frequently and occassionally they are stricken with a few bugs. Most of our scripts are written in Bourne Shell. To debug in the verbose mode, we append the -xv options to /usr/bin/sh.
Here's a demo script to illustrate the aforementioned comments.
#!/usr/bin/sh -xv
#Name: SampleScript
#Purpose: Demonstrate debug and verbose options.
#
#Menu
echo "Choose either P, D, Q "
echo "[P]rint"
echo "[D]elete"
echo "[Q]uit"
#Get letter from user
read letter
#Match response
case $letter
in
P|p) echo "Name of file to print."
read file
lp $file;;
D|d) echo "Name of file to delete."
read file
rm $file;;
*) echo "Quitting program";;
esac
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment