15,028
edits
| Line 73: | Line 73: | ||
One-liner shortcut: | One-liner shortcut: | ||
<pre> | <pre> | ||
# Detect current shell and set the corresponding config file | |||
RC_FILE="$HOME/.$(basename $SHELL)rc" | RC_FILE="$HOME/.$(basename $SHELL)rc" | ||
# Append the alias to the config file (>> appends without overwriting) | |||
echo 'alias code="open -a Visual\ Studio\ Code"' >> "$RC_FILE" | echo 'alias code="open -a Visual\ Studio\ Code"' >> "$RC_FILE" | ||
# Reload the config file so the alias takes effect immediately | |||
source "$RC_FILE" | source "$RC_FILE" | ||
</pre> | </pre> | ||