Hi,
I agree. Those back ticks are rough to read. I also was never
much for using \ to go to extend to another line.
Just string it onto one line. My two cents.
#!/bin/bash
TSTAMP=$(date +%Y-%m-%d-%H%M)
/usr/local/bin/tarsnap -c -v -f "pictures and music $TSTAMP"
/users/sa/music /users/sa/movies /users/sa/pictures
# End of the script
On 06/01/2016 04:20 PM, Garance AE Drosehn wrote:
Note that you do want the backward-quotes for the 'date' part,
but not for the full string. But it would also be easier to read
if you used the more modern alternative for the backward-quotes.
So try:
... -f "pictures-and-music $(date +%D-%M-%Y_%H-%M)"
Also, my guess is that you don't really want that first two
date-values to be "%D-%M". That gives you the full date followed
by the minute. I expect you want "%d-%m', which would give you
day-of-month followed by the month-number.
Personally, I prefer to order time values by "bigness", so I'd
use the order of year, month, day, hour, minute. To get that,
you'd go with:
... -f "pictures-and-music $(date +%Y-%m%d_%H%M)"
Note that you need the string-delimiters to be double-quotes,
not single-quotes. If you used single-quotes, then the shell
will not expand the $(date...) part.
I hope this helps.
-- garance alistair drosehn
On Wed, 1 Jun 2016 13:44:54 -0700
Sarah Alawami <[email protected]> wrote:
Here is the script.
#!/bin/sh
/usr/local/bin/tarsnap -c \
-v -f `pictures and music `date +%D-%M-%Y_%H-%M`` \
/users/sa/music /users/sa/movies /users/sa/pictures
# End of the script...
Do I have the right idea here? It looks like it half way works but it
is not naming the archive what I want to name it. Once I get this set
up I'll never need to worry again, I hope lol!
Everyone be blessed and have a happy wednesday.