Issue
I would like to check if a file exists, then if it does not, create it.
Consider an equivalent of the following C code but with shell scripting.
if(!exist) {
command;
command;
}
else {
command;
command;
}
Solution
You can use this:
if [ ! -e "$file" ]; then touch file else ... fi
Answered By - David Martínez Answer Checked By - Cary Denson (WPSolving Admin)