help-bash
[Top][All Lists]
Advanced

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

Re: Validating files and directories


From: Alex fxmbsw7 Ratchev
Subject: Re: Validating files and directories
Date: Sat, 13 Nov 2021 07:24:18 +0100

i always conpared [[ -e to 'if the element results in _not_ a not found' ,
just not bound to be -f

On Sat, Nov 13, 2021, 07:19 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:

> -a is like && 'and'
> -e means existing at all
> if -e is true it may be -d -f or fifo or socket, or such
>
> On Sat, Nov 13, 2021, 01:22 irenezerafa via <help-bash@gnu.org> wrote:
>
>> I am using the following commands to validate a file or directory.
>>
>> if [[ ! -f "$fl" && ! -d "$fl" ]]; then
>> printf '%s\n' "$fl: File or Directory does not exist"
>> fi
>>
>> But have noticed that I can use -e to see if there's something by that
>> name, instead of separately testing -f and -d.
>> Yet I am getting confused between using -a and -e.
>
>


reply via email to

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