Hello, guys...
I'm new to IBM AIX server admin. Actuall, I administrate Oracle 10g on it.
*SYSTEM INFO
IBM AIX 6 Powerpc
Oracle 10g R2 (10.2.0.4.0 - 64bit)
I wrote a script like bellow...
DATE='date'
cp /oracle/product/10g/network/log/listener_temp.log /oracle/product/10g/network/log/listener_temp_$DATE
cat /dev/null > /oracle/product/10g/network/log/listener_temp.log
# compress -vf /oracle/product/10g/network/log/listener_temp_$DATE
I declare a variable DATE at first line and result was below...
-rw-r----- 1 oracle dba 0 Apr 09 14:26 listener_temp.log
-rw-r----- 1 root system 0 Apr 09 14:26 listener_temp_date
I expected "listener_temp_20100408" like this.
However, result was like below "listener_temp_date"
what's problem?
Hello, guys...
I'm new to IBM AIX server admin. Actuall, I administrate Oracle 10g on it.
*SYSTEM INFO
IBM AIX 6 Powerpc
Oracle 10g R2 (10.2.0.4.0 - 64bit)
I wrote a script like bellow...
DATE='date'
cp /oracle/product/10g/network/log/listener_temp.log /oracle/product/10g/network/log/listener_temp_$DATE
cat /dev/null > /oracle/product/10g/network/log/listener_temp.log
# compress -vf /oracle/product/10g/network/log/listener_temp_$DATE
I declare a variable DATE at first line and result was below...
-rw-r----- 1 oracle dba 0 Apr 09 14:26 listener_temp.log
-rw-r----- 1 root system 0 Apr 09 14:26 listener_temp_date
I expected "listener_temp_20100408" like this.
However, result was like below "listener_temp_date"
what's problem?
Change the variable diclaration in code
DATE='date' # not corect
use
DATE=`date`
hi, amitranjansahu.
It's done. ` and ' is totally looks same. Thank you so much~
Do not use the backticks ("`"), as they are there only for backward compatibility and should not be used if more modern means are available. Use "$(command)" instead of "`command`":
date="$(date +'%Y%m%d')"
I hope this helps.
bakunin