On Sun, 24 Nov 2013, Matus UHLAR - fantomas wrote:

> >   And every week I teach SpamAssassin with those mailboxes with script:
> >   ====================================================
> >   #!/bin/sh
> >   DIR=/var/spool/mail/prem-ekb.ru
> >   sa-learn --clear
> >   sa-learn --spam ${DIR}/s...@prem-ekb.ru/cur/*S{a,}

>  In FreeBSD /bin/sh is a minimal POSIX bourne shell, brace expansion
>  isn't supported.

On 24.11.13 22:53, Гуляев Гоша wrote:
I will know that moment now, thanks!
But script are working, maybe because user root from which that script are starts uses /bin/csh shell?

this script starts with #!/bin/sh, which means it is supposed to run under
/bin/sh, where beace expansion does not need to be supported.

That doesn't necessarily mean the person writing (or later modifying) the script was paying attention when they wrote the brace-expansion bits, and it may have been tested on a system where /bin/sh was symlinked to /bin/bash or another shell that does support brace expansion (the default /bin/sh may have been overridden); also, the #! syntax won't override a command like "/bin/bash myscript".

But your point is taken. If it's using brace expansion, then it should probably start with #!/bin/bash rather than #!/bin/sh so that the correct shell gets run absent /bin/sh symlinks and an explict-shell command line.

--
 John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
 jhar...@impsec.org    FALaholic #11174     pgpk -a jhar...@impsec.org
 key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
  Of the twenty-two civilizations that have appeared in history,
  nineteen of them collapsed when they reached the moral state the
  United States is in now.                          -- Arnold Toynbee
-----------------------------------------------------------------------
 542 days since the first successful private support mission to ISS (SpaceX)

Reply via email to