[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: impressions of a new user
On Fri, Aug 15, 2003 at 09:42:10PM +0200, Marc Bevand wrote:
> No, it's wrong. You are using brace expansion, this is not a POSIX
> feature, so different shells may implement it differently.
I think their choice is wrong. This is not a chicken and egg problem.
ksh and csh existed before bash. UNIX existed before Linux and GNU.
I want my scripts to work the same. bash authors are very proud that
they implemented tcsh features that ksh couldn't have, being older than
tcsh. Why they had to screw up brace expansion? Take that script and
change it to csh:
======= cut =======
#!/bin/csh
set CMD="cat list.txt"
ls `${CMD}`
======= cut =======
The result:
> ./buginbash.csh
.Xdefaults .Xmodmap
The same as ksh.
I still believe it was a real shame ksh wasn't free. Now ksh93
(http://www.kornshell.com/) is open source, it is a much better language
then ever (it has some features one could do only in Perl), and is still
much smaller (and can I say safer?) than bash.
But people who started using Linux two months ago think that Linux and
bash are the beginning of time and should be used as a reference for
everything.
> Bash has choosed to do it before command substitution, see bash(1):
>
> Brace expansion is performed before any other expansions [...]
>
> Ksh has choosed to do it after, see ksh(1):
>
> The results of substitution [parameter, command, and
> arithmetic substitutions] are, unless otherwise specified,
> also subject to brace expansion [...]
I know that already. And it should read "*sh has chosen" above.
My point is that ksh has followed the tradition when implementing csh
features, bash didn't. And, frankly, I have trouble believing that the
motivation for the change in bash was security related. Perhaps I'm
wrong.
--
Zvezdan Petkovic <zvezdan@cs.wm.edu>
http://www.cs.wm.edu/~zvezdan/