Use alias source with relative path

Posted by notme on Super User See other posts from Super User or by notme
Published on 2014-06-02T08:42:10Z Indexed on 2014/06/02 9:32 UTC
Read the original article Hit count: 143

Filed under:
|
|
|

I want to add an alias file to my project folder to quickly open and edit files in it with a simple shell command.
To make it more portable, I would like to use only relative paths.
I want something like this:

### .profile

source /my/project/folder/aliases.bash

and

### aliases.bash

editprojectfiles="edit [/my/project/folder/]afile.txt"

The problem for me now is how to retrieve [/my/project/folder/] automatically. I tried to use $PWD variable, but the result is that the alias points to the folder of .profile file and not the aliases.bash ones. Is there a way to get this?

© Super User or respective owner

Related posts about linux

Related posts about osx