Home Man
Search
Today's Posts
Register

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"

Tags
hp-ux

👤 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:
Code:
while read queue size
do
  ...
done < $configfile

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

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:
Code:
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
Code:
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.
UNIX.COM Login
Username:
Password:  
Show Password