Variable assignment in sh

Matthew Seaman matthew at FreeBSD.org
Tue Jan 31 17:27:31 UTC 2017


On 2017/01/31 17:11, James B. Byrne via freebsd-questions wrote:
>> a shell script (FreeBSD's default scripting shell)

> What does this mean exactly?  Is not CSH a shell?  I thought that the
> shell used in cron was the shell of the user associated with the
> crontab file?  What is cron's default shell otherwise?

He's making a distinction between a shell for interactive use -- which
defaults to tcsh or csh in the FreeBSD base system -- and a shell used
for programming shell scripts -- which defaults to /bin/sh.

Of course, either shell can be used in either role, but writing scripts
in csh is a bit painful, and /bin/sh doesn't have all the nice
bells'n'whistles for interactive use.

The default shell used for cron jobs is /bin/sh, irrespective of the
login shell of the user who owns the crontab.  You can override this
from within the crontab by adding eg.

SHELL=/bin/tcsh

and, of course, you can just specify the appropriate shell on the
command line inside crontab or by setting a #! line at the top of any
executable scripts.

	Cheers,

	Matthew


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 972 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20170131/f3f6e5f5/attachment.sig>


More information about the freebsd-questions mailing list