LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-14-2005, 09:31 AM   #1
paraiso
Member
 
Registered: Apr 2005
Distribution: Fedora Core 4
Posts: 88

Rep: Reputation: 15
Question Shell script question


I want to check if the name of a file($x) is inside the file($fileName)but it doesn't work. What could it be ?

Code:
read x
	
awk '{ print $2 }' $fileName | grep -i $x
	
	
if [ $? -gt 0 ] 
then
        
 do that 

else
        
 do this
        
fi

Cheers
 
Old 05-14-2005, 10:37 AM   #2
paraiso
Member
 
Registered: Apr 2005
Distribution: Fedora Core 4
Posts: 88

Original Poster
Rep: Reputation: 15
just found out that the solution to my problem was to check if the command exit statue was equal to 0.

if [ $? -eq 0 ]


Bye
 
Old 05-15-2005, 01:55 AM   #3
mohit dhawan
Member
 
Registered: Mar 2005
Posts: 92

Rep: Reputation: 15
nice to answer ur own posts :wink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script Question abdul_zu Programming 7 10-06-2005 03:33 AM
shell script Question Whiteghost Programming 4 09-25-2005 10:05 PM
Shell Script Question. rvijay Linux - General 2 07-14-2005 06:41 PM
Shell script question... defa0009 Linux - General 7 04-26-2005 08:16 PM
shell script question rrwhite Linux - General 3 09-15-2004 01:01 AM


All times are GMT -5. The time now is 09:06 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration