I need to create a shell script that checks for the presence of a file and if it doesn't exist, creates it and moves on to the next command, or just moves on to the next command. What I have doesn't do that.
#!/bin/bash # Check for the file that gets created when the script successfully finishes. if [! -f /Scripts/file.txt] then : # Do nothing. Go to the next step? else mkdir /Scripts # file.txt will come at the end of the script fi # Next command (macOS preference setting) defaults write ...
line 5: [!: command not found mkdir: /Scripts: File exists
No idea what to do. Every place a Google search brings me indicates something different.