Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a script that gives me the following error:
Hi there,% Used Warn Filesystem Name CURRENT DISKSPACE STATUS
./diskspace.sh[25]: 0403-057 Syntax error at line 70 : `(' is not expected.The script is shown below:
# set -x
# D I S K S P A C E . S H
#
# 07/02/96
#
# Checks available disk space against a reference table,
# and flags the filesystems that are below their limit.
## 10/12/94 Original Version
# 03/06/96 Minor modifications for HP/UX 10.0
# 07/02/96 Fixes to handle multi-line df -k lines better
TABLE=/home/ora9/scripts/diskspace.tab
BOLD=`tput smso`
NORM=`tput rmso`if [ ! -f $TABLE ]
then TABLE=/home/ora9/scripts/diskspace.tab
echo "Using Table file : "$TABLE
fiecho "\n\n\n% Used\tWarn\tFilesystem Name\t\t\tCURRENT DISKSPACE STATUS"
echo---"df -k | while read LINE
do
set x ${LINE}
if [ -n "$3" ] # If $3 is null, suspect multiline fs
then
shift 5
else
read LINE
set x ${LINE}
shift 4
fiif [ -n "$1" -a "$1" != "used" ]
then
PERCENT=`echo $1 | tr -d '%'`
FILESYSTEM=$2set x `grep "^${FILESYSTEM} " ${TABLE}` # tab aftr FS
if [ -z "$3" ]
then
continue
fi
MAX=$3
ALARM=$4
if [ -z "$4" ]
then
ALARM=100
fi
if [ ${PERCENT} -gt $MAX ]
then
HDR=${BOLD}
TRL=${NORM}
if [ ${PERCENT} -gt $ALARM ]
then
TRL="$TRL\t\t\t\t*** CRITICAL ***"
else
TRL="$TRL\t\t\t\t*** WARNING ***"
fi
else
HDR=""
TRL=""
fiecho "${PERCENT}%\t(${MAX}%)\t${HDR}${FILESYSTEM}${TRL}"
fi
doneecho "\n"
exit 0
--------End of DISKSPACE.SHAny help will be appreciated.
Oracle DBA

It works OK on HP-UX.
On that echo on line 70, precede the left and right parentheses with backslashes.

echo "\n\n\n% Used\tWarn\tFilesystem Name\t\t\tCURRENT DISKSPACE STATUS"
echo---" <=== the problem is hereDon't trust copy/paste.
Luke Chi

thanks alot Guys for your help.
I took Luke's advice and commented out the echo----" and it seems to run now.
The problem i have is that its not returning any out put to me.
It reads a file called diskspace.tab with its contents below:
# D I S K S P A C E . T A B
#
# Lookup file for the 'diskspace.sh' program.
# Format: <filesystem> <flag_percent> <alarm_percent>
#
/ 60 80
/opt1% /aixpatch
/orasys1 60 95
/oradat1 95 95
/oraind1 60 95
/arch1 70 95
/stndarch
/redo1 50 95
/redo2 50 95
/orabin1 50 95
/orabin2 60 96
/backup 70 95
/exports 70 95
/oracds 60 90
/orabase 60 90---------END of DISKSPACE.TAB
Now I know for a fact that the file systems are overused so the script should return the file systems with their usage.
Can you guys please help me to see why this script is not returning any output.
I am new to this and appreciate all your help.
TonyOracle DBA

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |