Skip to content

Instantly share code, notes, and snippets.

@DominoPivot
Created September 2, 2022 06:29
Show Gist options
  • Save DominoPivot/c5bb82019c690fa9d7f1a21187e2de83 to your computer and use it in GitHub Desktop.
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.
#!/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"
@polypoyo
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment