if [ -d $1 ]; then
echo "That file is there and is a directory"
Here $1 is a variable input from the user in the terminal.
E.g. bash test.sh "Your path" where your path will become $1
else
echo "Not there or not a directory"
fi
if statements always close with fi
- commands e.g -d, -e. -f etc.
Link to sheet: Link
Top comments (0)