Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
==SOLVED==
Thanks KyleK!
How I solved it:
I just downloaded coreutils-6.12-1.tgz from http://inreto.de/dns323/fun-plug/0.5/packages/
and replaced /mnt/HD_a2/ffp/bin/date with bin/date from coreutils-6.12-1.tgz
Im trying to name a monthly backup as the month-year that it was from.
But I cant figure out how to echo last month's name. I googled it and none of the linux commands work in the 323's shell.
Thanks
Last edited by ameyer (2010-09-04 02:07:17)
Offline
Try this:
date "+%B-%Y"
See here full description of format string: http://unixhelp.ed.ac.uk/CGI/man-cgi?date
Last edited by scaramanga (2010-08-31 09:53:57)
Offline
Personally, I always use YYYYMMDD if I am including a date in a file name. It sorts sequencially that way.
Offline
FunFiler wrote:
Personally, I always use YYYYMMDD if I am including a date in a file name. It sorts sequencially that way.
I 2nd that. But that's what the guy (gal?) wanted - that's what he got.
Offline
Thanks guys
But that is this month right? I'm looking for last month. ( so if it is Aug - It will output July)
date "+%B-%Y"
Last edited by ameyer (2010-08-31 15:02:37)
Offline
Oh dear, are you sure it's worth the trouble? Here's how you can do it.
1. Create a file prev_month.txt (one month name per line, starting from December till November) like so:
December January February March April May June July August September October November
2. Take it for a spin. From the command line, test these commands:
/tmp # sed -n "1p" prev_month.txt December /tmp # sed -n "6p" prev_month.txt May /tmp # sed -n "12p" prev_month.txt November
3. Now we need to get the current date. Try this:
/tmp # sed -n "$(date "+%m")p" prev_month.txt July
4. Getting the year right (I bet you'd like to change Jan. 2011 to Dec. 2010):
I'll leave that as an exercise to you
Hint: Read here about Arithmetic Expressions and Flow-Control Constructs.
Last edited by scaramanga (2010-08-31 15:30:14)
Offline
Oh man!
In Bash you can just do something like
date --date="last month" +%Y-%m
Thanks
Offline
That's not a feature of bash, but of the 'date' command used. If it doesn't work for you, have a look at fonz' repositories, maybe he had a more 'complete' date.
Offline
The optware date command works with "last month".
Offline
I also had a look at it last night and managed to get previous month using the date command and expression evaluation $(( )) but stumbled on missing "leave out trailing 0" operator "-" in DNS-323 implementation which was confusing the integer maths: "%-m" does not work. And still the formula would have to be enhanced to include December last year when in January.
I would personally also vote for getting the latest "date" binary and use it in the simple script above.
Last edited by skydreamer (2010-08-31 19:49:56)
Offline
scaramanga wrote:
FunFiler wrote:
Personally, I always use YYYYMMDD if I am including a date in a file name. It sorts sequencially that way.
I 2nd that. But that's what the guy (gal?) wanted - that's what he got.
Sorry, didn't mean to sound like I was complaining, just wanted to offer the OP an option that may prove to be useful for them.
This is what I use in my shell scripts:
export cnd=`date +"%Y%m%d"`
The the variable "cnd" can be used throughout the script where required along with other actions.
Example
for i in "/home/d/*" ; do
tar -P -rf /archive/$cnd.tar $i
done
Last edited by FunFiler (2010-08-31 20:58:20)
Offline
'date' is part of coreutils, which you can find here: http://inreto.de/dns323/fun-plug/0.5/packages/
fonz's version (6.12) does support "last month", although there are much newer releases of coreutils.
Offline
Thanks! worked perfectly
How I solved it:
I just downloaded coreutils-6.12-1.tgz from http://inreto.de/dns323/fun-plug/0.5/packages/
and replaced /mnt/HD_a2/ffp/bin/date with bin/date from coreutils-6.12-1.tgz
KyleK wrote:
'date' is part of coreutils, which you can find here: http://inreto.de/dns323/fun-plug/0.5/packages/
fonz's version (6.12) does support "last month", although there are much newer releases of coreutils.
Offline