Created
September 2, 2022 06:29
-
-
Save DominoPivot/c5bb82019c690fa9d7f1a21187e2de83 to your computer and use it in GitHub Desktop.
Script that lets you be very lazy when it comes to creating/reopening a project in VS Code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$#" -ne 1 ]; then | |
cat <<- EOF | |
Usage: $0 PROJECT | |
Creates the ~/workspace/PROJECT directory if it doesn't exist and opens it in VS Code. | |
EOF | |
exit 1 | |
fi | |
mkdir -p ~/workspace/"$1" | |
code ~/workspace/"$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
exit 1
tells the shell that something went wrong. This is useful for scripting, but some shells can be configured to look different when the last command exited with a non-zero exit-code. Additionally,[
is actually a command that exits 0 when the condition inside passes.