Portál AbcLinuxu, 8. května 2025 15:44
if [ -e /etc/passwd ]takto
if ! [ -e /etc/passwd ]nebo takto
if [ ! -e /etc/passwd ]nebo jinak? Díky
Řešení dotazu:
How do I tell if a file does not exist in bash?
if statement negation
$ man test $ man bash
$ [ ! -e /etc/fstab ]; echo $? 1 $ [ ! -e /etc/aaa ]; echo $? 0 $ ! [ -e /etc/fstab ]; echo $? 1 $ ! [ -e /etc/aaa ]; echo $? 0 $ ls $(which [) /usr/bin/[
Negaci umí jak samotný Bash, tak program test tj. [.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.