urgent: script problem???


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting urgent: script problem???
# 1  
Old 07-12-2007
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  
Old 07-12-2007
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  
Old 07-12-2007
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
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  
Old 07-12-2007
Quote:
Originally Posted by skyineyes
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  
Old 07-12-2007
skyineyes,

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

Please adhere to the rules. You are very close to earning a ban.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

URGENT Reading a file and assessing the syntax shell script URGENT

I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies

2. Shell Programming and Scripting

Script Performance problem . urgent frnds

HI frnds I have one flat with data and am loading the data into oracle table. While loading , rejected records are captured in log file. Now I want to read the log file and get the all rejected records and the reason for the rejection. I developed the script . its finding 5000 rejected... (7 Replies)
Discussion started by: Gopal_Engg
7 Replies

3. Shell Programming and Scripting

urgent lprm problem

hi all i have printer call prt1 we send to this printer some job and then we want to cancel it. we did lpstat no job id found so i did lprm and it wrote to me No active jobs on prt3!(which i don't have this kind of printer) then i wrote lprm prt1 lprm: No active jobs on prt1! ... (0 Replies)
Discussion started by: naamas03
0 Replies

4. UNIX for Advanced & Expert Users

A problem in autosys-- very urgent

Hi , I have 5 jobs in autosys which are dependant on one another oen by one.say job1,job2.. job5. job 1 is a filewatcher.job2 to job5 are command jobs.First the filewatcher starts as when a file which it is looking for arrives.based on this job rest of the sequence starts.after the job5 is... (0 Replies)
Discussion started by: mohanpadamata
0 Replies

5. Shell Programming and Scripting

Getting Following problem when opening shell script (Very Urgent)

Hi All, Actually when i am trying to open my shell script file 1.sh then i am getting the following error. > vi 1.sh "/var/tmp/ExdNaarK" No space left on device Can anybody tell me that how to rectify it. It is very urgent. Because i am not able to do any work due to the above error. ... (1 Reply)
Discussion started by: sunitachoudhury
1 Replies

6. Shell Programming and Scripting

date problem -- URGENT

Hi All, When i run date command at unix prompt, i get the output in format Tue Aug 29 12:36:18 GMT 2006 when i write the shell script i should be able to export the date output with format as YYYY/MM/DD-HH:MM:SS into some variable(ex : dateop). and when i say echo ${dateop} i should... (9 Replies)
Discussion started by: rkrgarlapati
9 Replies

7. HP-UX

Urgent printing problem

I can no longer print from HP-UX 10. All the printers are network printers. I have already stopped and restarted the spooler (lpshut and lpsched), but still the same problem. The printers react when I ping them. I have also tried with SAM, but the system cannot find the printers. Can somebody... (1 Reply)
Discussion started by: filipd
1 Replies

8. Solaris

Another Urgent HDD problem

I have another Hdd problem with Ultra 1 machine the hdd is segate (+-)17560 MB and when I start installtion of sun solaries 2.6 the system sees the hdd correctly, and the installtion goes fine with partioning the disk as follows / 150 MB swap 500 MB /user 1000 MB /user1 100MB /usr3 5500 MB... (4 Replies)
Discussion started by: adol3
4 Replies

9. UNIX for Dummies Questions & Answers

help urgent problem

i accedently "deleted" all workspaces I have a black screen and dont know what to do solaris common desktop enviroment (1 Reply)
Discussion started by: ssshakir
1 Replies

10. UNIX for Dummies Questions & Answers

Urgent problem with wtmpx

Hi everybody I have a problem with wtmpx. Accounting file. I activated it. It works but to well :( Writes the same message every minute. "faxmodem" As you can see it does not take to long until my /var file is soon full. Thanks Peter (26 Replies)
Discussion started by: Peterh
26 Replies
Login or Register to Ask a Question