Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Shell scripts - please help!!!!
Name: Daon Date: May 5, 2003 at 18:51:59 Pacific OS: Windows CPU/Ram: Pentium 4 256 MB
Comment:
Please help...I'm very new to Unix. I need a script (myscript)that takes the command line arguments and displays like:
%myscript John Smith
%Hello John %Your last name is: Smith
And another script (myage) that subtracts the age (that's supplied as a command line argument)from the year 2003:
Name: David Perry Date: May 5, 2003 at 20:31:42 Pacific
Reply:
#!/bin/sh if [ $# -ne 2 ] ; then echo "Error. Usage $0 firstname lastname" exit 4 else echo "Hello $1" echo "Your last name is $2" fi ----------------------- #!/usr/local/bin/ksh if [ $# -ne 1 ] ; then echo "Error. Usage $0 age " exit 4 else YEAR=`date +%Y` ((birthyear = $YEAR - $1)) echo "Were you born in $birthyear?" fi
0
Response Number 2
Name: LANkrypt0 Date: May 6, 2003 at 05:30:12 Pacific
Summary: hi, i have an entry: FileName=/home/mqm/adr10098/sample.dat in a file. I want to open this file, search for "FileName=" and then replace the value with someother value(eg: /home/mqm/adr10098/another.d...
Summary: I'm completely new to shell programming. As this is quite urgent, please offer your help. Thanks a lot! If there is a text file which contains: 1. Amt = 1000 Date = 01012003 =========================...
Summary: Can anyone suggest me any shell script that automatically mails the desired address. What are the required parameters necessary to write such a script. Please help me ! ...