help-bash
[Top][All Lists]
Advanced

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

Re: Validating files and directories


From: Chris Elvidge
Subject: Re: Validating files and directories
Date: Sat, 13 Nov 2021 12:50:25 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 Lightning/5.4

On 13/11/2021 06:19 am, Alex fxmbsw7 Ratchev 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

I suggest you reread 'help test'


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.



--
Chris Elvidge
England




reply via email to

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