I need to run a shell script with dynamic command in it like
# Begin script...
mysql xx "select * from tab" | sed 's/\t/|/g' > GENERATED_20100304.txt
the dynamic part is 20100304 which should be today's date, and it needs to run every day and create a new file with GENERATED_YYYYMMDD.txt
Any thoughts ?
Scott
2
Like so?:
DATE=$(date '+%Y%m%d')
# Begin script...
mysql xx "select * from tab" | sed 's/\t/|/g' > GENERATED_$DATE.txt
Thanks Scott.
I overlooked $(date '+%Y%m%d') ' single quote earlier.
You know how we can avoid ^m chars ? im getting it at the end of the file.
Thanks again.
---------- Post updated at 08:28 PM ---------- Previous update was at 08:11 PM ----------
dos2unix did the trick. Thanks anyways.