tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Weirdness in /bin/sh of 8.0



On 14 August 2018 at 16:53, Robert Elz <kre%munnari.oz.au@localhost> wrote:
>
>
>   | You mean "need to be fixed in the script" or "need to be fixed in sh"?
>
> Fixed in the script.   Not things which would stop it working, just stuff
> done the wrong way.
>
> Eg: somewhere in there I saw
>         somevar="$@"
>
> "$@" only has defined results when used in a conrext where field splitting
> would normally occur, as despite the quotes, it produces multiple words.
> variable assignments are not such a place - there a single string is needed
> (and the quotes are rarely, if ever, needed).   The script should use "$*"
> instead - one of few times the quotes are required (I think, I'd need to check.)

As the original perpetrator of pkg_chk, I think it might have been
fair to say that at that time I knew *about* programming in sh... (not
warranting anything about my current level here either :)

If you had any other comments on obvious things you noticed which
could be transitioned from "technically works" to "correct" I would be
all ears :-p

Thanks

David


Home | Main Index | Thread Index | Old Index