The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
A problem in autosys-- very urgent mohanpadamata UNIX for Advanced & Expert Users 0 04-02-2008 08:39 AM
Getting Following problem when opening shell script (Very Urgent) sunitachoudhury Shell Programming and Scripting 1 03-31-2008 07:01 AM
Another Urgent HDD problem adol3 SUN Solaris 4 11-21-2005 02:04 PM
help urgent problem ssshakir UNIX for Dummies Questions & Answers 1 12-01-2004 12:25 PM
ulimit problem(Urgent) informshilpa UNIX for Advanced & Expert Users 1 03-05-2002 04:45 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-12-2007
skyineyes skyineyes is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 150
urgent: script problem???

#!/usr/bin/sh
read file
#exec 3<&0
exec 0<$file
while read line
do
if [ $count -eq 4 ]
then
BOUND=$line
break
fi
count=`expr $count + 1`
done
#exec 0<&3
echo $BOUND



sh check.sh

myfile.txt


after runing the script i am getting following error messages
check.sh[7]: test: 0403-004 Specify a parameter with this command.
expr: 0402-050 Syntax error.
check.sh[7]: test: 0403-004 Specify a parameter with this command.
expr: 0402-050 Syntax error.
  #2 (permalink)  
Old 07-12-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
Code:
#!/usr/bin/sh
read file
#exec 3<&0
exec 0<$file
while read line
do
        if [[ $count -eq 4 ]]
        then
                BOUND=$line
                break
        fi
        count=`expr $count + 1`
done
#exec 0<&3
echo $BOUND
  #3 (permalink)  
Old 07-12-2007
skyineyes skyineyes is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 150
Re:

Still syntax errors.

could you please try running the script on your machine.

myfile.txt has following

1
2
3
4
5
6


Quote:
Originally Posted by lorcan View Post
Code:
#!/usr/bin/sh
read file
#exec 3<&0
exec 0<$file
while read line
do
        if [[ $count -eq 4 ]]
        then
                BOUND=$line
                break
        fi
        count=`expr $count + 1`
done
#exec 0<&3
echo $BOUND
  #4 (permalink)  
Old 07-12-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Quote:
Originally Posted by skyineyes View Post
Still syntax errors.

could you please try running the script on your machine.

myfile.txt has following

1
2
3
4
5
6
Intialize count to zero before while loop
  #5 (permalink)  
Old 07-12-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
skyineyes,

You are repeatedly breaking the rules by bumping up your posts. See your original thread - http://www.unix.com/shell-programmin...rror-line.html and this locked thread - http://www.unix.com/shell-programmin...5-problem.html

Please adhere to the rules. You are very close to earning a ban.
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 04:11 AM.


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