We have two simple shell scripts here, to check the directory is already exist in your current location,
#!/bin/bash
DIRECTORY="LINUXFAQ"
if [ -d "$DIRECTORY" ]; then
echo "The Directory $DIRECTORY is exist"
fi
or put ! symbol before the -d
if [ ! -d "$DIRECTORY" ]; then
echo "The Directory $DIRECTORY does not exist"
fi
Comments (0)