How do I write this as an alias?p() {    DIR=~/projects/$@    pushd $DIR}This is as far as I got, but it's piping stdin to pushd instead of xargs:alias p=xargs printf ~/projects/%s | pushdIt's probably better as a function, but I feel like I would learn something by knowing how to write it on one line and get the piping correct.Thanks!
Help writing bash function as one-line alias
bash;alias
As @AndreasWiese comments, you can't do this with an alias. Aliases tack on arguments space-separated, so you can't join them (in a simple way) to the aliased command.A comment on your function: Why are you using $@? You should use $1 instead. If you call your function with multiple arguments (p a b c), you'll probably get an error (b: command not found) an unknown directory.