[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to name an archive



*** It's surely the backticks. When the shell sees backticks, it runs the command that's inside the backticks, and
substitutes the OUTPUT of the command.

So for example if I say "echo ls", I get "ls". If OTOH I say "echo `ls` ( with backticks ),
I get a list of files.

Even more interesting - if I say "cat `ls`", I get the content of all the files. In general - single quotes mean - get me everthing inside the single quotes VERBATIM - don't interpret special chars. - double quotes mean - get me everything inside the quotes, but do interpret special chars and do variable substitution - backquotes means = run the program inside the backquotes and get me its output

                              - Jerry Kaidor

On 06/01/2016 13:44, Sarah Alawami wrote:
Ok, I'm doing a test run on a script but I can't figure out why this
is happening. I pt the name of the archive between ` marks including
time and date format I wanted. I got the following output.

pictures: command not found

It then lists the files that I guess are being uploaded so now I'm a
bit confused.

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.