Linux shell programing validating date

After that, you need to build some type of script header telling users who wrote the script, what the script does, and when it was written.You can name your script anything you want, but you usually use the extension to refer to a Korn shell script.This way, you could get a copy of all the new users added to the system every day.

You just learned how to read from a file with a for loop and how to cut out just a username and redirect the output to a file or to your terminal.Every time you run a command in AIX, the system sets a variable that is often referred to as dollar question. In Korn shell scripting, the word function is a reserved word.AIX sets this to either 0 for successful or non-zero for failure. Listing 7 shows how the $date Sat May 10 EDT 2008 $echo $? Functions are a way to divide the script into segments.Now it's time to start writing some Korn shell code. In this case, use the /etc/passwd file you already defined in your script, and print just the usernames, as shown in Listing 4. /bin/ksh ################################################### # Written By: Jason Thomas # Purpose: This script was written to show users how to develop their first script # May 1, 2008 ################################################### #Define Variables HOME="/home/jthomas" #Simple home directory DATE=$(date) # Set DATE equal to the output of running the shell command date HOSTNAME=$(hostname) # Set HOSTNAME equal to the output of the hostname command PASSWORD_FILE="/etc/passwd" # Set AIX password file path #Begin Code for username in $(cat $PASSWORD_FILE | cut -f1 -d:) do print $username done tells the print command to append each username one after another to a file only.By doing this, you never see the text display on your terminal.

linux shell programing validating date-33linux shell programing validating date-69linux shell programing validating date-88

Join our conversation (90 Comments).
Click Here To Leave Your Comment Linux shell programing validating date.

Comments:

Leave a Reply

Your email address will not be published. Required fields are marked *