I'm trying to create a bash alias alias backlight='__backlight () { echo "$@"; cd ~/Code/MSI-Backlight; sudo nodejs ~/Code/MSI-Backlight/msi-backlight.js "$@"; }'
, it works fine with no parameters but breaks when I give it one. It works fine outside of an alias. Does anyone know what's wrong?
Add a comment
|
You should define it as a function and call it with the alias:
function __blacklight() {
echo "$@";
cd ~/Code/MSI-Backlight;
sudo nodejs ~/Code/MSI-Backlight/msi-backlight.js "$@";
}
alias backlight='__blacklight'
-
6
-
It works, is there also a way I could make it not actually change direcotires, like using parenthesies in aliases? – Aido Sep 24 '15 at 1:34
-