help-bash
[Top][All Lists]
Advanced

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

Re: Deleting files


From: michael-franzese
Subject: Re: Deleting files
Date: Mon, 22 Feb 2021 13:31:37 +0100





> Sent: Monday, February 22, 2021 at 11:05 PM
> From: "Chris Elvidge" <celvidge001@gmail.com>
> To: help-bash@gnu.org
> Subject: Re: Deleting files
>
> On 22/02/2021 06:39 am, michael-franzese@gmx.com wrote:
> > How can I write the following compactly
> >
> > if (( nargs > 2 )); then
> >      if [[ "${3}" == "t" ]]; then
> >     remove_file=true
> >      fi
> > fi
>
> Here, you don't really need to check number of arguments. If $3 is not
> given, it will be unset, so:
>
> [ "$3" = "t" ] && remove_file=true
>
> will do it.
> Should you check for "T" as well?

I could do with that as well.

> --
> Chris Elvidge
> England
>
>
>



reply via email to

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