Unix shell script

digs developer
digs developer used Ask the Experts™
on
How to create the file with time stamp in unix shell script ?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT Supervisor
Top Expert 2009
Commented:
Something like this?
DATE=`date "+%Y%m%d-%H%M%S"`
FILE="myfile_$DATE"
echo "this is something in my new file" > $FILE

Open in new window

ozo
Most Valuable Expert 2014
Top Expert 2015

Commented:
Or do you mean this?
touch file

Open in new window

Top Expert 2007

Commented:
touch file_$(date +%Y%m%d)

or

echo "Some text" >file_$(date +%Y%m%d)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial