|
FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
Using Date variable?
I'm writing a backup script and I'd like to include the date in the dump filename. How can I write on the date and not time/sec?
|
|
|||
I would use the international date format YYYY-MM-DD, so that a command like ls sorts them correctly
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
Great suggestions. Thanks.
|
|
|||
I tried using the new varialbe name, but instead of creating a name with the date the filename comes out exactly as typed in the code above "var.dump- date +%d.%m.%Y.bz2"
What am I missing? I couldn't find anything on this at the freebsd site. |
|
|||
Oops. Thanks. That did it. Hard to tell the difference between ` and ' on the screen.
|
|
|||
Some people may find the back-quotes visually confusing, here is another option:
$ dump -0Lauf - /var | bzip2 > /home/var.dump-$(date "+%Y.%d.%m").bz2 In this case, anything inside $(..) is executed. EDIT: My sincere apologies, I forgot I was on the FreeBSD board.. the above will not work in csh. Last edited by BSDfan666; 12th August 2008 at 07:59 PM. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[fman] tags out of date for ports | BSDKaffee | Feedback and Suggestions | 1 | 12th June 2009 07:36 AM |
echo tcpdump date to an output | bsdnewbie999 | Programming | 8 | 8th April 2009 02:58 PM |
Python: Use the value of a variable for calling another variable | Carpetsmoker | Programming | 13 | 5th April 2009 05:53 PM |
CSH 'mch' variable? | JMJ_coder | General software and network | 1 | 12th February 2009 11:24 PM |
HOWTO: Always install an up-to-date port | chris | Guides | 8 | 28th May 2008 11:53 AM |