I'm trying to create an alias that will create a file and open it in VS Code.
Create an alias called create <filename> that will execute touch <filename> && code <filename>.
For example create app.js should execute touch app.js && code app.js.
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"; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With