bash if statement
and - &&
or - ||
# and example
if [ -r $1 ] && [ -s $1 ]
then
echo This file is useful.
fi
# or example
if [ $USER == 'bob' ] || [ $USER == 'andy' ]
then
ls -alh
else
ls
fiOperator Description
! EXPRESSION The EXPRESSION is false.
-n STRING The length of STRING is greater than zero.
-z STRING The lengh of STRING is zero (ie it is empty).
STRING1 = STRING2 STRING1 is equal to STRING2
STRING1 != STRING2 STRING1 is not equal to STRING2
INTEGER1 -eq INTEGER2 INTEGER1 is numerically equal to INTEGER2
INTEGER1 -gt INTEGER2 INTEGER1 is numerically greater than INTEGER2
INTEGER1 -lt INTEGER2 INTEGER1 is numerically less than INTEGER2
-d FILE FILE exists and is a directory.
-e FILE FILE exists.
-r FILE FILE exists and the read permission is granted.
-s FILE FILE exists and it's size is greater than zero (ie. it is not empty).
-w FILE FILE exists and the write permission is granted.
-x FILE FILE exists and the execute permission is granted.
Also in Shell:
- powershell parameter
- utorrent on ubuntu
- cmd rename multiple folders
- install tqdm
- instalación de angular cli
- electron
- grep search for text in php files recursive
- matplotlib change he yticks to two number after digit
- linux check file contetns
- sudo msys2
- git command to get the repo url
- réinstaller interface graphique debian
- rejected master -> master (non-fast-forward)
- date command in linux
- linux create user
- pytorch anaconda install windows
- linux how to see directory data usage
- powershell convert text 20MB to bytes
- rtl8821ce driver linux
- gzip folder with tar and exclude directories
- How to call one shell script from another shell script?
- powershell create symlink
- how to install mongoose
- how to get divided number in mac terminal