123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- 1
- 0
- NAME
- exists - check whether items exist
- SYNOPSIS
- exists [EXPRESSION]
- DESCRIPTION
- Checks whether the given item exists and returns an exit status of 0 if it does, else 1.
- OPTIONS
- -a ARRAY
- array var is not empty
- -b BINARY
- binary is in PATH
- -d PATH
- path is a directory
- This is the same as test -d
- -f PATH
- path is a file
- This is the same as test -f
- --fn FUNCTION
- function is defined
- -s STRING
- string var is not empty
- STRING
- string is not empty
- This is the same as test -n
- EXAMPLES
- Test if the file exists:
- exists -f FILE && echo 'The FILE exists' || echo 'The FILE does not exist'
- Test if some-command exists in the path and is executable:
- exists -b some-command && echo 'some-command exists' || echo 'some-command does not exist'
- Test if variable exists AND is not empty
- exists -s myVar && echo "myVar exists: $myVar" || echo 'myVar does not exist or is empty'
- NOTE: Don't use the '$' sigil, but only the name of the variable to check
- Test if array exists and is not empty
- exists -a myArr && echo "myArr exists: @myArr" || echo 'myArr does not exist or is empty'
- NOTE: Don't use the '@' sigil, but only the name of the array to check
- Test if a function named 'myFunc' exists
- exists --fn myFunc && myFunc || echo 'No function with name myFunc found'
- AUTHOR
- Written by Fabian Würfl.
- Heavily based on implementation of the test builtin, which was written by Michael Murphy.
- BUGS
- Please report all bugs at https://gitlab.redox-os.org/redox-os/ion/issues.
- Ion is still in active development and help in finding bugs is much appreciated!
- AUTHORS
- The Ion developers, under the Redox OS organisation
- 0
- NAME
- exists - check whether items exist
- SYNOPSIS
- exists [EXPRESSION]
- DESCRIPTION
- Checks whether the given item exists and returns an exit status of 0 if it does, else 1.
- OPTIONS
- -a ARRAY
- array var is not empty
- -b BINARY
- binary is in PATH
- -d PATH
- path is a directory
- This is the same as test -d
- -f PATH
- path is a file
- This is the same as test -f
- --fn FUNCTION
- function is defined
- -s STRING
- string var is not empty
- STRING
- string is not empty
- This is the same as test -n
- EXAMPLES
- Test if the file exists:
- exists -f FILE && echo 'The FILE exists' || echo 'The FILE does not exist'
- Test if some-command exists in the path and is executable:
- exists -b some-command && echo 'some-command exists' || echo 'some-command does not exist'
- Test if variable exists AND is not empty
- exists -s myVar && echo "myVar exists: $myVar" || echo 'myVar does not exist or is empty'
- NOTE: Don't use the '$' sigil, but only the name of the variable to check
- Test if array exists and is not empty
- exists -a myArr && echo "myArr exists: @myArr" || echo 'myArr does not exist or is empty'
- NOTE: Don't use the '@' sigil, but only the name of the array to check
- Test if a function named 'myFunc' exists
- exists --fn myFunc && myFunc || echo 'No function with name myFunc found'
- AUTHOR
- Written by Fabian Würfl.
- Heavily based on implementation of the test builtin, which was written by Michael Murphy.
- BUGS
- Please report all bugs at https://gitlab.redox-os.org/redox-os/ion/issues.
- Ion is still in active development and help in finding bugs is much appreciated!
- AUTHORS
- The Ion developers, under the Redox OS organisation
- 0
- 1
- 0
- 0
- 0
- 0
- 1
- element
- 0
- 0
- 0
- PATH = testing/
- empty_file
- executable_file
- file_with_text
- symlink
- 0
- 1
- 1
- Reset PATH to old path
- 0
- 0
- 1
- 1
- 0
- 1
- 0
- 1
- 0
- 0
- emptyvar =
- 1
- testvar = foobar
- 0
- 0
- 0
- ion: expansion error: Variable does not exist
|