Hi ALL,
I've question about grouping of commands in the bash.
For the sake of simplicity I'll show a bit artificial example but it explain the issue.
For example I can run following commands:
Code:
$ date; date
Wed Dec 12 11:52:46 EET 2012
Wed Dec 12 11:52:46 EET 2012
Excellent, but now I would like to run the same commands in different time zone:
Code:
$ TZ='Asia/Kolkata' date; date
Wed Dec 12 15:24:07 IST 2012
Wed Dec 12 11:54:07 EET 2012
Not perfect, the result is not exactly what I want. The first command executed in the specified timezone but the second one is executed in default system timezone. But I would like to run both commands in the specified timezone.
I know that bash allows grouping of executed commands like below:
Code:
$ (date; date)
Wed Dec 12 11:58:56 EET 2012
Wed Dec 12 11:58:56 EET 2012
Unfortunately in this syntax I can't specify timezone:
Code:
$ TZ='Asia/Kolkata' (date; date)
bash: syntax error near unexpected token `('
So, can anybody help me and show correct syntax of command line.
Thanks.
P.S. I know that I can export variable TZ to environment and then execute commands from the example, but I want to find out how to do that with help of a single command line