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.
loops in shell scripts!!!
Name: mdp02ab Date: June 11, 2003 at 08:26:32 Pacific OS: Unix CPU/Ram: P4
Comment:
Hi,
I'm trying to run loops in shell scripts using the following script.
loop=1 while [ loop -lt 10 ] do echo 'this is my $loop text-line' loop='expr $loop + 1' done ---- but I'm getting error: test: unknown parameter $loop when I change ' by " in the above expr statement, I get the error: test: unknown parameter 0
I need urgent help for this script. please mail your responses to: mdp02ab@sheffield.ac.uk
Name: David Perry Date: June 11, 2003 at 11:29:22 Pacific
Reply:
while [ $loop -lt 10 ] ; do echo "this is my $loop text-line" loop=`expr $loop + 1` done
you need a "$" before the variable. expressions with variables need double quotes use the back-tick character instead of a single quote for evaluation.
Summary: In shell script sed or awk command, can I use hexadecimal code for substitution? I want to perform the following: Input file: Line1 Line2 Line3 Line4 Output file: (all in one line now) Line1Line2Line...
Summary: Dear all, I wonder how to find the size of an array in shell script. For example, I declared an array as following: #! /bin/sh a = (1 adf 8 2 se) How could I get the size of the array a? I had searche...
Summary: In shell script I am inserting the record in to the table.After excuation the script output is commit complete which is fine but I need my echo should be display like "Account created" #!/bin/ksh . . ...