I cheat by running a cron every night at 23:58 that echo's the date into a yesterday.dat file I then can use this file the next day for all sorts of things like pulling over yesterdays log files from another server ....
heres what I use ..
#!/bin/sh
# Filename: tok.sh
# This is a simple script to get the formatted date
# YYYYMMDD into a file that can be used for yesterdays date
# the following day
#######
#
# Tarn 03-04-02
# Used in
++++++++++++++++++++++++++++++++++++
more yesterday.dat
20030316
++++++++++++++++++++++++++++++++++++
Use it like so .. for FILE in /var/log/weblog.`cat yesterday.dat` ; do scp $FILE someone@somewhere:/tmp ; done
Or
In your case
%>mv myfile.txt myfile.`cat yesterday.dat`
tarn, you get a star for thinking outside the box. Too many people forget that you can achive what you want without having to do exactly what you are thinking. Those are usually the best solutions. Einstein47 ("Vision without action is a daydream - Action without vision is a nightmare. Japanese Proverb"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.