Bash – concatenate a bash alias

aliasbashrcssh

Sample : to use Composer locally, I must write :

php composer.phar

After some locals installation of Composer, I want to alias it only "composer" but keeping absolute path with "pwd" command. I tried something like this in my .bashrc file :

alias composer='php ' . pwd . '/composer.phar'

Tested with this signs : ".", "+", ";", "&&" and “nothing” but none works.

And nothing found in Wikipedia article, official documentation or other stack question.

Best Answer

You could add a subshell to your alias.

alias composer='php $(pwd)/composer.phar'
Related Question