Difference between revisions of "Script Course"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
==Tests== | == File Operators Tests== | ||
[[File:Escape sequence.jpg|thumb|Escape Sequence]] | [[File:Escape sequence.jpg|thumb|Escape Sequence]] | ||
[[File:Test Statements.jpg|thumb|Test Statements]] | [[File:Test Statements.jpg|thumb|Test Statements]] | ||
* -d File True if file is a directory | |||
* -e File True if file exists | |||
* -f File True if file exists and is a regular file | |||
* -r File True if file is readable by you | |||
* -s File True if file exist and is not empty | |||
* -w File True if the file is writable by you | |||
* -x File True if the file is executable by you | |||
Syntax | Syntax | ||
[condition to test for] | [condition to test for] |
Revision as of 19:54, 12 March 2019
File Operators Tests
- -d File True if file is a directory
- -e File True if file exists
- -f File True if file exists and is a regular file
- -r File True if file is readable by you
- -s File True if file exist and is not empty
- -w File True if the file is writable by you
- -x File True if the file is executable by you
Syntax
[condition to test for]
Example
[ -e /etc/passwd ] -e True if file exists