The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-24-2008
oxoxo oxoxo is offline
Banned
  
 

Join Date: Sep 2008
Posts: 38
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
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:36 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0