Reputation: 3701
I'm using hsenv. To activate it I need to do this:
cd ~/projects/foo
hsenv
source .hsenv_foo/bin/activate
I'm looking for a way to replace third command with an alias. The problem is there's a path-dependent component in the path to activate
script.
How can I replace the foo
in .hsenv_foo
by the name of actual directory that I'm currently in?
Upvotes: 1
Views: 196
Reputation: 72547
I'm not sure how to do it in an alias, but you can wrap it in a function:
function my-hsenv {
# If we want the full path
# foo=`pwd`;
# If we want only the name of the current dir
foo=$(basename $(pwd))
source .hsenv_${foo}/bin/activate
}
Then run my-hsenv
:
$ my-hsenv
my-hsenv:source:5: no such file or directory: .hsenv_tmp/bin/activate
But you get the idea.
Upvotes: 2