[Top][All Lists]

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

Re: detecting no arguments in $@

From: Andreas Kusalananda Kähäri
Subject: Re: detecting no arguments in $@
Date: Sun, 25 Jul 2021 13:11:14 +0200

On Sun, Jul 25, 2021 at 01:07:53PM +0200, wrote:
> Is it possible to figure out whether there are no arguments in $@ ?

If there are no positional parameters, i.e. if "$@" is empty, then "$#"
would be zero:

        if [ "$#" -eq 0 ]; then
                echo 'there were no arguments given'

Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden


reply via email to

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