![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Writing a Utility Script | raghav1982 | Shell Programming and Scripting | 10 | 04-21-2008 08:23 AM |
| Extracting select queries from script | DILEEP410 | Shell Programming and Scripting | 3 | 04-10-2008 07:16 AM |
| Need help on SCRIPT(1M) utility | amit4g | UNIX for Dummies Questions & Answers | 1 | 11-23-2006 12:49 AM |
| Want to use the output of Select statement in Unix script | akhilgoel9 | Windows & DOS: Issues & Discussions | 4 | 05-27-2005 06:52 AM |
| Pipe SQL select statement results to script | houtakker | UNIX for Dummies Questions & Answers | 6 | 10-31-2003 10:20 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
script not working...select utility
#!/usr/bin/bash
name="$@" myname=malay #echo $myname select firstname in $name; do if [$firstname!= $myname];then echo $firstname else break fi done invoking with:- ./script.sh one two three four five six seven eight nine malay according to me the program control should come out when i will select the entry having my name[malay] but its not happening can any one point out the error |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Hi,
Syntax error is there in the test condition. space must be there after the opening bracket and bfore the closing bracket, like this if [ $firstname != $myname ];then Thanks Penchal |
|
#3
|
|||
|
|||
|
put this line at the beginning of the script and debug it.
Code:
set -x |
|
#4
|
|||
|
|||
|
ash-3.00$ ./script.sh one two three four malay
one two three four malay malay 1) one 2) two 3) three 4) four 5) malay #? 1 ./script.sh: line 12: [: one!=: unary operator expected bash-3.00$ this is the error coming |
|
#5
|
|||
|
|||
|
what are the changes that you made to the script
|
|
#6
|
|||
|
|||
|
make the changes as penchal suggested it will work fine for you..
There should be space as he suggested. Thanks |
|
#7
|
|||
|
|||
|
okay i got hold of the error
[ $firstname != $myname ] ...i was missing the spaces in between thanks everyone who cared to help |
|||
| Google The UNIX and Linux Forums |