- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: If conndition error
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
09-01-2009 02:25 AM
09-01-2009 02:25 AM
Wen i try the below if condition i am geting the below error.
fs_check.sh[24]: 65%: Expression is not complete; more tokens expected.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2009 02:28 AM
09-01-2009 02:28 AM
Re: If conndition error
Provide a script snip.
Most likely its just a syntax error in and if ... fi or similar loop.
Without the code its hard to tell.
Get me the entire condition loop and a few lines above. Sometimes an expression above line 24 in this case triggers the error by not being closed.
Look for variables being tested that have no declared data, things like that.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2009 02:45 AM
09-01-2009 02:45 AM
Re: If conndition error
I'm then going to go on and guess that if you run bdf manually you will see one of the filesystems being split across 2 lines, and this is what is upsetting your script...
And finally I'm going to suggest that instead of re-inventing the wheel, you simply use Bill Hassell's bdfmegs utility to do what you need:
http://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1326767
If I'm way off the mark here then apologies...
HTH
Duncan
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2009 02:48 AM
09-01-2009 02:48 AM
Re: If conndition error
Just below is my coed.
Its woking 5n for solairs servers.
I guess some problem in IF condition :(
#!/bin/sh
#
touch /tmp/mountpoint_output.txt
rm /tmp/mountpoint_output.txt
touch /tmp/mountpoint_output.txt
/usr/bin/clear
OS_TYPE=`uname -s`
Dat=`date +%d/%m/%y`
if [ "$OS_TYPE" = "HP-UX" ]
then
cont=`bdf | awk '{if (NF==1) {line=$0;getline;sub(" *"," ");print line$0} else {print}}' | wc -l`
cnt=`expr $cont - 1`
bdf | awk '{if (NF==1) {line=$0;getline;sub(" *"," ");print line$0} else {print}}' | tail -$cnt | awk '{print $5"#"$6}' > /tmp/mountpoint.txt
else
cont=`df -k | wc -l`
cnt=`expr $cont - 1`
df -k | tail -$cnt | awk '{print $5"#"$6}' > /tmp/mountpoint.txt
fi
i=`cat /tmp/mountpoint.txt`
for x in $i
do
mountpoint_size=`echo $x | awk -F"#" '{print $1}'`
mountpoint_name=`echo $x | awk -F"#" '{print $2}'`
if [ "$mountpoint_size" -gt 30% ]
then
echo "Mountpoint $mountpoint_name is $mountpoint_size full" >> /tmp/mountpoint_output.txt
echo "----------------------------------------------------------------------" >> /tmp/mountpoint_output.txt
if [ "$OS_TYPE" = "HP-UX" ]
then
du -akx $mountpoint_name | sort -nr | head -50 >> /tmp/mountpoint_output.txt
else
du -akd $mountpoint_name | sort -nr | head -50 >> /tmp/mountpoint_output.txt
fi
echo "----------------------------------------------------------------------" >> /tmp/mountpoint_output.txt
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2009 03:28 AM
09-01-2009 03:28 AM
Solution> fs_check.sh[24]: 65%: Expression is not complete; more tokens expected.
...points to line-24, not the 'if' condition involving the OS_TYPE.
However, your problem is:
if [ "$mountpoint_size" -gt 30% ]
...which should be something like:
if [ $(echo "$mountpoint_size"|sed -e s/%//) -gt 30 ]
...to remove the "%" character
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2009 04:26 AM
09-01-2009 04:26 AM
Re: If conndition error
>
>...to remove the "%" character
If he's using the hp shell this could also be written without invoking sed
if [[ ${mountpoint_size%\%} > 30 ]]; then
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2009 04:48 AM
09-01-2009 04:48 AM
Re: If conndition error
But wen i try the same on solaris server, I am geting an error as shown below :(
could you please help me on this?
fs_check.sh: syntax error at line 24: `(' unexpected
I guess, solairs server not accepting IF condition accordinlgy :(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2009 04:51 AM
09-01-2009 04:51 AM
Re: If conndition error
So try replacing the $(...) expression for your Solaris version by a pair of backticks `...`,
or better change to a more modern shell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2009 04:51 AM
09-01-2009 04:51 AM
Re: If conndition error
Instead of
if [ $(echo "$mountpoint_size"|sed -e s/%//) -gt 30 ]
try:
if [ `echo "$mountpoint_size"|sed -e s/%//` -gt 30 ]
HTH
Duncan
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2009 05:53 AM
09-01-2009 05:53 AM