cmackowski
IS-IT--Management
I need to make a variable to the previous day to grep items from /var/adm/messages. The command works fine from prompt. Once you turn it into variable, the formatting is wrong.
bash-2.05$ /usr/bin/perl -e 'print substr(localtime(time-86400), 4, 6),"\n";'
Dec 9 <<<Correct, with two spaces between Dec and 9<<<
bash-2.05$ YESTERDAY=`/usr/bin/perl -e 'print substr(localtime(time-86400), 4, 6),"\n";'`
bash-2.05$ echo $YESTERDAY
Dec 9 <<<incorrect<<<
Any Ideas??
-Chris
bash-2.05$ /usr/bin/perl -e 'print substr(localtime(time-86400), 4, 6),"\n";'
Dec 9 <<<Correct, with two spaces between Dec and 9<<<
bash-2.05$ YESTERDAY=`/usr/bin/perl -e 'print substr(localtime(time-86400), 4, 6),"\n";'`
bash-2.05$ echo $YESTERDAY
Dec 9 <<<incorrect<<<
Any Ideas??
-Chris