![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sed very confused | minifish | Shell Programming and Scripting | 14 | 04-14-2008 01:08 PM |
| confused | sauravjung | UNIX for Dummies Questions & Answers | 1 | 04-07-2008 11:08 AM |
| confused about tar | frustrated1 | SUN Solaris | 5 | 06-24-2004 11:50 AM |
| confused | hapiworm | UNIX for Dummies Questions & Answers | 4 | 06-17-2002 03:30 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
well, i read in a book, Code:
if [ $# -eq 2 ]; then cp $1 $2 $0 $2 else tmp=`cat $1 | wc -l` echo $tmp while [ $tmp -ne 0 ] ; do echo `head -$tmp $1 | tail +$tmp` >> $1.tmp tmp=$(($tmp -1)) done mv $1.tmp $1 fi but i cant figure out how this Code:
cp $1 $2 $0 $2 could affect the script |
|
|||||
|
That looks better. Code:
if [ $# -eq 2 ]; then cp $1 $2 $0 $2 else Here's my analysis. If you have 2 command line arguments provided by the user, then make argument 2 the same as argument 1. And after you are done with that, execute the script with $2 as an argument. In the shell scripting world, $0 holds the name of the script. So basically, you call the script with the value held in $2. Let me know if you dont understand. Vino Last edited by vino; 05-24-2005 at 04:41 AM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|