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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script help 1

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
 
I know this is a simple question but do you have the correct permissions set on lth_test.dat? Also try print instead of echo when sending you variables to the file.

[morning] needcoffee
 
DATE1='date' *** will never return anything regarding a *date* AKA 05-19-2006, but will return the word date. If you want the date value use $(date) or `date` (backticks).

Same thing with MIN_VAL='grep -E "minimum available" /cachesys/mgr/ckey.out|tr -s '[:space:]'|cut -d" " -f5' ### As above, use backticks or $()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top