Horje
shell script to check the directory exists Code Example
shell script to check the directory exists
Directory="/opt"
if [ -d "$Directory" ];
then
	echo -e "it's exits\n"
fi
### To check if it's not exists
if [ ! -d "$Directory" ];
then 
	echo -e "It's not there\n"
fi
linux command if directory exists
DIR="/etc/httpd/"
if [ -d "$DIR" ]; then
  ### Take action if $DIR exists ###
  echo "Installing config files in ${DIR}..."
else
  ###  Control will jump here if $DIR does NOT exists ###
  echo "Error: ${DIR} not found. Can not continue."
  exit 1
fi




Shell

Related
kubectl list context Code Example kubectl list context Code Example
check service logs linux Code Example check service logs linux Code Example
git show last commit Code Example git show last commit Code Example
install virtualenv Code Example install virtualenv Code Example
git search history for file Code Example git search history for file Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
14