Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple script not working

Status
Not open for further replies.

teakandme

MIS
Jun 10, 2004
57
US
I created the following script, which is simple by nature, but can not get it to run properly. I exported each variable and echo the varible at the command line to confirm that the variable is returning value, but this will not write out/append to the file as intended. I think I am missing something?

#!/usr/bin/ksh #
# #
# Script: lth_test #
# #
# Rev By Date Description #
# 1.0 Lien Huynh 05/18/2006 This will append to a file that will #
# maintain the minimum avaiable and the date/time #
# so trending and/or analysis can be done later #
#########################################################################################

DATE1='date'
FILE1="/home/lhuynh/lth_test.dat"

#The following command gets the numerical value of the minimum available

MIN_VAL='grep -E "minimum available" /cachesys/mgr/ckey.out|tr -s '[:space:]'|cut -d" " -f5'

echo "$MIN_VAL $DATE1" >> $FILE1

#grep -E "minimum available" /cachesys/mgr/ckey.out|tr -s '[:space:]'|cut -d" " -f5 >> lth_test.dat
 
DATE1=$(date)
FILE1='/home/lhuynh/lth_test.dat'
MIN_VAL=$(grep -E "minimum available" /cachesys/mgr/ckey.out|tr -s '[:space:]'|cut -d" " -f5)
echo "$MIN_VAL $DATE1" >> $FILE1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top