HP-UX: Shell Script giving " 0^J30: Syntax error"


Login to Reply

Thread Tools Search this Thread
# 15  
Old 03-09-2014
A better approach would be to use a while read loop instead:
while read queue size
done < $configfile

Instead of
for queue in `cat ${configfile}|cut -d ' ' -f1`
  size=`cat ${configfile}|grep "$queue"|cut -d " " -f2`

This User Gave Thanks to Scrutinizer For This Post:
vai_sh (03-09-2014)
# 16  
Old 03-09-2014
Thanks for suggestion on using 'WHILE' loop with 'READ'.
Will try to use this in the script.
# 17  
Old 03-10-2014
Another tip:
size=`awk '$1==q {print $2; exit}' q="$queue" ${configfile}`

compares exactly the first column, and returns after the first match, so is more robust than
size=`grep -w "$queue" ${configfile} | cut -d " " -f2`

In contrast to grep it does not use regular expressions e.g. "tellabs[78]100" won't match.
Login to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

Similar Threads More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Keep getting error "-bash: ./.profile_z2: line 52: syntax error: unexpected end of file" getzeeshan BSD 3 06-09-2017 11:04 AM
Bash Script giving "Command Not found" infinitydon Shell Programming and Scripting 6 10-03-2013 01:21 PM
Error"syntax error at line 15: `end of file' unexpected" millan Shell Programming and Scripting 5 05-31-2013 05:14 AM
Help with FTP Script which is causing "syntax error: unexpected end of file" Error mahi_mayu069 Shell Programming and Scripting 1 04-25-2013 08:27 AM
How to lclear "expr: syntax error" eventhough everything looks fine? lathanandhini Homework & Coursework Questions 6 03-18-2013 01:37 PM
Syntax error near unexpected token `"Hit <ENTER> to continue:"' lathigara Shell Programming and Scripting 7 07-31-2012 06:52 PM
Bash (Ubuntu server): Syntax error: "|" unexpected in While-loop primaxx Shell Programming and Scripting 3 09-19-2011 04:20 PM
read -n1 -r -p "Press..." key / produces error in bash shell script linuxinho Shell Programming and Scripting 4 05-26-2010 02:56 PM
Error with "multiplication table" in shell script vinodpaw Shell Programming and Scripting 4 03-22-2010 07:27 AM
Setting shell variables with ":" syntax muddasani UNIX for Dummies Questions & Answers 3 02-16-2010 08:54 AM
ksh-script "arithmetic syntax error" comparing strings old_mike Shell Programming and Scripting 3 10-14-2009 11:40 AM
"too big" and "not enough memory" errors in shell script jerardfjay AIX 11 03-17-2009 12:09 AM
In ksh shell command - Print "-ABC" is giving error sagarjani Shell Programming and Scripting 2 10-08-2008 05:32 PM
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 12:16 PM
"syntax error at line 21 :'done' unexpected." error message" ibroxy Shell Programming and Scripting 3 08-08-2007 07:45 AM
All times are GMT -4. The time now is 11:31 PM.

Unix & Linux Forums Content Copyright 1993-2018. All Rights Reserved.
Show Password

Not a Forum Member?
Forgot Password?