- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Problem with "while" loop in ksh
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2003 11:41 AM
06-06-2003 11:41 AM
Problem with "while" loop in ksh
This script fails with a "while" loop, but works with a "for" loop. Note in the output that the "exit 1" is executed, but the script doesn't stop. Why is that?
symbcv list > ${TEMP_FILE}
#for STD in `awk '{print $1}' ${BCVFILE}`
cat ${BCVFILE} | while read STD BCV
do
grep " $STD " ${TEMP_FILE} | grep -q Sync
# 0 = true; 1 = false
if [[ $? = 0 ]]
then
echo "ERROR: STD's in ${BCVFILE} are synched to another BCV." >> ${L
OG}
grep " $STD " ${TEMP_FILE} | grep -v " $BCV " >> ${LOG}
echo "Exiting at `date | awk '{print $4}'`." >> ${LOG}
exit 1
fi
done
check_fs
symmir -f ${BCVFILE} -sid ${SID} establish -noprompt >> ${LOG} 2>&1
read STD BCV
+ symbcv list
+ 1> /tmp/bcv_ops.tmp
+ read STD BCV
+ cat /usr/local/bin/timefinder.try/bcv_files/tr2_bcv_file
+ grep 019 /tmp/bcv_ops.tmp
+ grep -q Sync
+ [[ 0 = 0 ]]
+ echo ERROR: STD's in /usr/local/bin/timefinder.try/bcv_files/tr2_bcv_file are synched to another BCV.
+ 1>> /var/opt/timefinder/logs/bcv_ops_tr2_sync.060603-1535.log
+ grep -v 140
+ grep 019 /tmp/bcv_ops.tmp
+ 1>> /var/opt/timefinder/logs/bcv_ops_tr2_sync.060603-1535.log
+ awk {print $4}
+ date
+ echo Exiting at 15:35:12.
+ 1>> /var/opt/timefinder/logs/bcv_ops_tr2_sync.060603-1535.log
+ exit 1 <== executes but keeps on going ???
+ check_fs
+ echo vtr201
+ + ls /dev/vtr201
/dev/vtr201 not found
TEST_VOL=
+ [ -n ]
+ symmir -f /usr/local/bin/timefinder.try/bcv_files/tr2_bcv_file -sid 0421 establish -noprompt
+ 1>> /var/opt/timefinder/logs/bcv_ops_tr2_sync.060603-1535.log 2>& 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2003 12:34 PM
06-06-2003 12:34 PM
Re: Problem with "while" loop in ksh
VAR1
VAR2
try
VAR1 VAR2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2003 12:35 PM
06-06-2003 12:35 PM
Re: Problem with "while" loop in ksh
VAR1
VAR2
try
VAR1 VAR2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2003 12:38 PM
06-06-2003 12:38 PM
Re: Problem with "while" loop in ksh
019 13D
01A 13E
01B 13F
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2003 12:43 PM
06-06-2003 12:43 PM
Re: Problem with "while" loop in ksh
I changed " $STD " to "$STD" in the
grep " $STD " ${TEMP_FILE} | grep -q Sync
This then worked.
Regards,
dl