[Linuxcommand-discuss] question about redirection
Brought to you by:
bshotts
From: Bram M. <bra...@li...> - 2004-02-11 14:37:16
|
Hi I would like to use the following script to start evolution from now on so the output would be logged. Can I replace the "/data/logs/evolution.log" with a variable? Right now it looks quite ugly and reusing the script for other apps would involve too much typing/a high risk of typos/not enough laziness :) --- script --- #!/bin/bash echo "" >> /data/logs/evolution.log echo "--- $(date +"%R %A, %B %-d, %Y") ---" >> /data/logs/evolution.log evolution >> /data/logs/evolution.log 2>&1 --- end --- Can I replace it with something like: --- script --- #!/bin/bash logfile="/data/logs/evolution.log" echo "" >> $logfile echo "--- $(date +"%R %A, %B %-d, %Y") ---" >> $logfile evolution >> $logfile 2>&1 --- end --- TIA -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # SuSE 8.2 Pro kernel 2.4.20-4GB i686 128MB RAM # # 3:30pm up 19 days 19:08, 6 users, load average: 0.37, 0.27, 0.12 # |