help-bash
[Top][All Lists]
Advanced

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

Re: Which one to use - $@ "$@" $*


From: Alex fxmbsw7 Ratchev
Subject: Re: Which one to use - $@ "$@" $*
Date: Fri, 23 Apr 2021 18:36:47 +0200

"$@" if as argument, "$*" if as one string
bo quotes needed when no argument, eg in var definition phase

On Fri, Apr 23, 2021, 18:09 <pauline-galea@gmx.com> wrote:

> Have written a grep function to which I can pass arguments.
> Am am using "$@".  Reading about this, I found people claiming
> that $@ should be quoted, others say it is not required.
>
> Furthermore, there is $* which does not need quoting.
> I need help to resolve this because it is still not
> clear to me which one to use - $@ "$@" $*
>
> Here are same examples of how I use it.
>
> mygrep -C8 "Great Britain" ./gungadin
> mygrep -nhC8 "Great Britain" .
> mygrep -C8 --exclude=\*.texi --include=\*.el France .
> mygrep -C8 --exclude=\*.{org,texi} --include=\*.el France .
>
> mygrep ()
>   {
>     grep -ir --include=\*.{org,texi} "$@"
>   }
>
>
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]