![]() |
|
|
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 |
| passing Argument | Shahul | Shell Programming and Scripting | 4 | 11-13-2008 08:50 AM |
| -exec argument | habuzahra | Shell Programming and Scripting | 2 | 11-12-2008 05:57 PM |
| How to find the last argument in a argument line? | nehagupta2008 | UNIX for Dummies Questions & Answers | 4 | 06-20-2008 12:05 PM |
| On Time-Series Analysis with Strict Determinism | iBot | Complex Event Processing RSS News | 0 | 03-29-2008 11:40 PM |
| argument help | brentdeback | Shell Programming and Scripting | 2 | 11-27-2005 03:53 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Strict Argument
Im trying to write a bash script that has an if statment that when the user enters ONLY that exact argument, will echo what follows that conditon. For example: Code:
for file in $1
do
if [ $ == "$1" ]
then
Var1=$(cat hello | egrep "that pattern" | awk '{ print $NF }')
cat $Var1
fi
done
Basically, if i specify anything other then 1 as this cmd files argument, it wont output anything. But if i do specify 1 it will output the value that Var1 is holding... Another problem tha t i was having is that it will output when any 1 argument is passed. For example if 2 arguments are passed it wont output anything. If no arguments are passed it wont output anything. But it really doesnt matter what 1 argument i specify, it will output as long as 1 argument is givin. What im trying to figure out from that point is how to write an if statement that looks for an exact match of that 1 argument that the user would specify. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|