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

Re: not in X. man command does not respect set bell-style visible



On Thu, Mar 1, 2012 at 3:40 PM, Claudius Hubig <nfs_2012@chubig.net> wrote:
> Andrei POPESCU <andreimpopescu@gmail.com> wrote:
>>On Jo, 01 mar 12, 18:02:40, Claudius Hubig wrote:
>>>
>>> #!/bin/sh
>>> /bin/less -q $*
>>
>>I've read somewhere that "$@" (including the quotes) is safer in such
>>situations.
>
> That’s also what keeps lingering in the back of my head. However, I
> cannot recall the reasons why $* would be unsafe. Unfortunately,
> googling for either $* or $@ is not exactly…helpful.
>
> Maybe you have a link or a hint to a man page regarding this topic?
> bash(1) does not appear to mention $@.

It respects spaces:

$ th() { for i in $*; do echo $i; done }
$ th first "second long"
first
second
long

$ th() { for i in $@; do echo $i; done }
$ th first "second long"
first
second
long

$ th() { for i in "$*"; do echo $i; done }
$ th first "second long"
first second long

$ th() { for i in "$@"; do echo $i; done }
$ th first "second long"
first
second long


Reply to: