bash if statement
Shell
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:
- Title
- linux spotify client
- Category
- Shell
- Title
- download images from url terminal
- Category
- Shell
- Title
- force git to use ssh
- Category
- Shell
- Title
- gitlab download
- Category
- Shell
- Title
- bash rename file
- Category
- Shell
- Title
- createa. branch off of development git
- Category
- Shell
- Title
- android_home ubuntu
- Category
- Shell
- Title
- install zsh debian
- Category
- Shell
- Title
- ubuntu logout
- Category
- Shell
- Title
- npm install --global vue-cli
- Category
- Shell
- Title
- configure samba on RPI
- Category
- Shell
- Title
- ufw allow port
- Category
- Shell
- Title
- install bootstrap angular
- Category
- Shell
- Title
- mac cleanup github
- Category
- Shell
- Title
- no ip raspberry manually update
- Category
- Shell
- Title
- how to fix the errors in chokidar in linux
- Category
- Shell
- Title
- ogv to gif linux
- Category
- Shell
- Title
- command line how to find all files that have a string
- Category
- Shell
- Title
- Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS
- Category
- Shell
- Title
- git commit
- Category
- Shell
- Title
- docker node alpine
- Category
- Shell
- Title
- install vuex
- Category
- Shell
- Title
- maven install on mac os x
- Category
- Shell
- Title
- what does git fetch do
- Category
- Shell
- Title
- remove git tracking
- Category
- Shell
- Title
- kill process on port
- Category
- Shell
- Title
- git create new branch from current
- Category
- Shell
- Title
- java to jar
- Category
- Shell
- Title
- too many security failures vnc
- Category
- Shell
- Title
- uninstall g2o
- Category
- Shell
- Title
- composer install ignore platform reqs
- Category
- Shell
- Title
- linux find file containing text
- Category
- Shell
- Title
- sudo apt-get update
- Category
- Shell
- Title
- how to grep if the first letter is a character not a number
- Category
- Shell
- Title
- linux install node
- Category
- Shell
- Title
- bash generate random number between
- Category
- Shell
- Title
- get github profile image
- Category
- Shell
- Title
- git config --global credential.helper osxkeychain
- Category
- Shell
- Title
- npm list global packages
- Category
- Shell
- Title
- random in mac terminal
- Category
- Shell
- Title
- kali linux change keyboard layout
- Category
- Shell
- Title
- shared folder virtualbox ubuntu
- Category
- Shell
- Title
- upgrade yarn version
- Category
- Shell
- Title
- git reset hard
- Category
- Shell
- Title
- how to remove git directory in terminal
- Category
- Shell
- Title
- SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:341:17 @(connect):2:6
- Category
- Shell
- Title
- react-easy-crop install
- Category
- Shell
- Title
- how to perform mathematical operations in shell script
- Category
- Shell
- Title
- how to save any changes in vi editor
- Category
- Shell
- Title
- gatsby-plugin-typography
- Category
- Shell
- Title
- xbox 360 wireless adapter linux
- Category
- Shell
- Title
- install chromedriver linux command line
- Category
- Shell
- Title
- uninstall cinnamon
- Category
- Shell
- Title
- remove yum package
- Category
- Shell
- Title
- bash find file
- Category
- Shell
- Title
- debian install git server
- Category
- Shell
- Title
- conda install paraview
- Category
- Shell
- Title
- how to connect to the database as root user in linux
- Category
- Shell
- Title
- how to install axios in react
- Category
- Shell
- Title
- git list remote branches
- Category
- Shell
- Title
- linux zip a directory
- Category
- Shell
- Title
- release tag github
- Category
- Shell
- Title
- vim command to open a file
- Category
- Shell
- Title
- git revert merge
- Category
- Shell
- Title
- npm install jquery
- Category
- Shell
- Title
- whats the internet
- Category
- Shell
- Title
- python spawn shell
- Category
- Shell
- Title
- unzip a tar.gz file in linux
- Category
- Shell
- Title
- install jake
- Category
- Shell
- Title
- remove .svn recursively linux
- Category
- Shell
- Title
- git remove all files in gitignore
- Category
- Shell
- Title
- find flutter version
- Category
- Shell
- Title
- bash script loop
- Category
- Shell
- Title
- get git remote url
- Category
- Shell
- Title
- How to find your ip on debian linux wsl
- Category
- Shell
- Title
- find node version
- Category
- Shell
- Title
- install vuex orm
- Category
- Shell
- Title
- choco installation
- Category
- Shell
- Title
- hash bang bash
- Category
- Shell
- Title
- ssh github generate key
- Category
- Shell
- Title
- list interfaces centos
- Category
- Shell
- Title
- A template was not provided. This is likely because you're using an outdated version of create-react-app. Please note that global installs of create-react-app are no longer supported.
- Category
- Shell
- Title
- how to set up git ssh creds to push
- Category
- Shell
- Title
- set git pull rebase default
- Category
- Shell
- Title
- install react yarn
- Category
- Shell
- Title
- pip install ScraperAPIClient
- Category
- Shell
- Title
- how to echo to a file in linux
- Category
- Shell
- Title
- how to switch branches in git
- Category
- Shell
- Title
- heroku cli delete app
- Category
- Shell
- Title
- update google chrome command ubuntu
- Category
- Shell
- Title
- could not connect to server: Connection refused Is the server running on host and accepting TCP/IP connections on port 5432?
- Category
- Shell
- Title
- npm install react
- Category
- Shell
- Title
- babel source maps
- Category
- Shell
- Title
- remove git credentials terminal
- Category
- Shell
- Title
- powershell append to file
- Category
- Shell
- Title
- ubuntu fractional scaling
- Category
- Shell
- Title
- brew minikube custom version install
- Category
- Shell
- Title
- create github repo with curl
- Category
- Shell
- Title
- remove directory in cmd
- Category
- Shell
- Title
- using regex in bash conditional statement
- Category
- Shell