The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
set Working day in ksh Rafael.Buria Shell Programming and Scripting 1 10-09-2007 05:42 AM
Not working Mandab Shell Programming and Scripting 7 05-11-2007 10:23 PM
FTP is not working. ronald_brayan Security 10 04-04-2007 09:23 AM
sed not working baanprog UNIX for Advanced & Expert Users 5 09-18-2006 09:11 AM
why is this not working? matt2kjones UNIX for Dummies Questions & Answers 2 07-09-2002 04:58 PM

Closed Thread
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
  #1 (permalink)  
Old 10-12-2007
scanner248 scanner248 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 6
If not working

Novice/amature to UNIX programming.
Setting up if statement in shell script.

Code:(It's named test1)
while read tool
do
if ["$tool" = "nsr9"]
then
set machID=AD29018
echo @machID
else
echo "nope"
printf "%s\n" $tool
fi
done < nsrlist

Contents of the file that is being read(the file name is nsrlist)
nsr9
nsr10
nsr11
nsr12
nsr13

Output I'm getting:
> ./test1
./test1[5]: [nsr9: not found
nope
nsr9
./test1[5]: [nsr10: not found
nope
nsr10
./test1[5]: [nsr11: not found
nope
nsr11
./test1[5]: [nsr12: not found
nope
nsr12
./test1[5]: [nsr13: not found
nope
nsr13

WHAT am I missing?????
Not much of my hair is left right now.......
  #2 (permalink)  
Old 10-12-2007
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131

Code:
while read tool
do
    if [ "${tool}" = 'nsr9' ]; then
       machID='AD29018'
       echo ${machID}
    else
       echo 'nope'
       printf "%s\n" $tool
    fi
done < nsrlist

  #3 (permalink)  
Old 10-12-2007
scanner248 scanner248 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 6
I and my remaining hair thanks you.
Closed Thread

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:40 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