You don't have copy them one by one, you can paste all the lines together and newlines will work as Enter.
The reason that
doesn't work is that because it's executed in a subshell. It would work if you printed contents of the variable before the final
It's explained in ...
The parenthesis you used causes the enclosed commands to be executed by a subshell; hence once that shell exits, de variables are still not set in the current shell.
I'm at a loss why you think those parenthesis would set those variables "in one go", or why it would be necessary to them them "in one go"; however you could place those assignments on one line ...
A single - generally means either standard input or standard output:
standard input if it’s used in a context where the input is specified (as in your zip example),
standard output in a context where the output is specified (as in your wget example).
It’s used as a special filename, with options which accept filenames; thus it only has a special meaning if ...
The problem here seems to be with the single-quotes in $DATEJ. Your variable imposes them.
Change that to
DATEJ=`echo -n "2012-03-02 22:00"`
and in the final command:
date -d "$DATEJ EDT" +%s
This will work:
$ date -d '2012-03-02 22:00 EDT' +%s
$ DATEJ=`echo -n "2012-03-02 22:00"`
$ echo $DATEJ
$ date -d "$DATEJ EDT" +%s
The backslashes do nothing.
The - and + characters do not need to be escaped, because they are not special in any way in the syntax of any shell.
$ set -o xtrace
$ date +%F-%T
+ date +%F-%T
$ date \+%F\-%T
+ date +%F-%T
As you can see in the above trace output, the command that gets executed by the shell is the ...