I'm trying to create an alias that will create a file and open it in VS Code.
Create an alias called create
that will execute touch
.
For example create app.js
should execute touch app.js && code app.js
.
Answer
From man bash
, under ALIASES
:
There is no mechanism for using arguments in the replacement text. If arguments are needed, a shell function should be used (see FUNCTIONS below)."
Thus:
create() { touch "$1"; code "$1"; }
No comments:
Post a Comment