Bash file attribute operators
Überprüft, ob es Datei gibt
Basiswissen
Beispiel: if [ -a test ]; then cat test; fi
Falls es die Datei test gibt, zeige ihren Inhalt an.
Alle Operatoren:
- a file exists
- d file exists and is a directory
- e file exists; same as -a
- f file exists and is a regular file (i. e. not a directory)
- r you have read permission on file
- s file exists and is not empty
- w you have write permission on file
- x you have execute permission on file
- x you have directory search permission
- N file was modified since it was last read
- O you own file
- G file's group ID matches yours
- file 1 -nt file2
Das Datum der Änderung zählt.
- file 1 -ot file 2
Das Datum der Änderung zählt.