Crontab entries
Steven W. Orr
steveo at syslang.net
Thu Feb 16 13:19:00 EST 2006
On Thursday, Feb 16th 2006 at 12:54 -0500, quoth Paul Lussier:
=>Is there a requirement to place parens around a set of commands
=>delimeted by a ';' for crontab entries?
=>
=>At some point I got in the habit of creating entries like:
=>
=>30 02 * * * (foo;bar;baz)
=>
=>But nowhere can I find documentation even mentioning the use of
=>parens. Of course, I haven't even seen mention of having cron exec'ing
=>multiple commands either...
=>
=>Using the parens definitely works, I'm just trying to figure where I
=>picked up that habit...
Parens are one of the two grouping operators. The other is curly braces.
Note that the syntax for curlys is different than for parens.
{ cmd1; cmd2; cmd3; }
That last semicolon is required.
The functional difference is that parens cause its content to execute in a
seperate subshell. The only reason to do so is if a command sequence would
change something about the current environment that subsequent commands
would not want. e.g.,
pwd # Here I am
qaz=44 # Here's what it is.
(cd foo; foo=55; bar)
pwd # I'm still where I started and $foo is still 44.
echo $foo
So the answer is that it is not needed to group your cron entry in parens.
It just burns an extra shell.
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
More information about the gnhlug-discuss
mailing list