[olug] Script help

Christopher Cashell topher-olug at zyp.org
Mon Dec 29 01:02:30 UTC 2008


On Sun, Dec 28, 2008 at 5:58 PM, Edward Pluta <epluta3 at cox.net> wrote:
> You can also use the reverse quotes ` to execute the command. Like this
>
> DIRNAME=backup_`date +%Y-%m%d`
>
> to yield the same results as in the example below. This method also works
> for ksh and csh.

The $(command) notation should also work in any modern Korn shell
implementation.  It was specified in both POSIX and SUS (backticks are
actually deprecated).  I don't think it works in csh, but then again,
scripting in csh should be illegal anyway, as it has some broken
behaviors that can bite you badly with scripting.  tcsh does fix many
of them, but I still wouldn't ever recommend using it for scripting.

-- 
Christopher



More information about the OLUG mailing list