Home Man
Today's Posts

HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

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`

The Following User Says Thank You to Scrutinizer For This Useful 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

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 10:04 AM
Bash Script giving "Command Not found" infinitydon Shell Programming and Scripting 6 10-03-2013 12:21 PM
Help with FTP Script which is causing "syntax error: unexpected end of file" Error mahi_mayu069 Shell Programming and Scripting 1 04-25-2013 07:27 AM
read -n1 -r -p "Press..." key / produces error in bash shell script linuxinho Shell Programming and Scripting 4 05-26-2010 01:56 PM
Error with "multiplication table" in shell script vinodpaw Shell Programming and Scripting 4 03-22-2010 06:27 AM
Setting shell variables with ":" syntax muddasani UNIX for Dummies Questions & Answers 3 02-16-2010 07:54 AM
ksh-script "arithmetic syntax error" comparing strings old_mike Shell Programming and Scripting 3 10-14-2009 10:40 AM
In ksh shell command - Print "-ABC" is giving error sagarjani Shell Programming and Scripting 2 10-08-2008 04:32 PM
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 11:16 AM
"syntax error at line 21 :'done' unexpected." error message" ibroxy Shell Programming and Scripting 3 08-08-2007 06:45 AM

All times are GMT -4. The time now is 01:48 PM.

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