I'm running Ubuntu 12.04 and trying to be ale to use both the Heroku CLI as well as the newly-downloaded AWS Elastic Beanstalk CLI tools.
I have this code in my .bashrc already:
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
And I also want to export this:
#for Elastic Beanstalk - madebyian
export PATH=$PATH:/opt/AWS-ElasticBeanstalk-CLI-2.6.0/eb/linux/python3/
How do I get both CLI tools and/or what's wrong with my syntax EDIT:[if anything]?
You can export it as many times as you want, it will make no difference (after the first export, obviously).
All export
does in this context (other than changing the variable itself due to the =
) is mark a variable so that it's exported to the environment of future commands.
You can mark it so as much as you want. The effect of the two commands:
export PATH="/usr/local/heroku/bin:$PATH"
export PATH=$PATH:/opt/AWS-ElasticBeanstalk-CLI-2.6.0/eb/linux/python3/
will be to mark PATH
as an export variable (it probably is so already since you generally want your path to be inherited) and set it to:
/usr/local/heroku/bin:$PATH:/opt/AWS-ElasticBeanstalk-CLI-2.6.0/eb/linux/python3/
where $PATH
was the path before executing those commands.
The only thing you need to be careful of is the ordering. For example, if /usr/local/heroku/bin
contains an executable program called ls
, that's probably going to make life difficult for you if you're trying to get a directory listing. For that reason, I tend to add directories only to the end of the path.
Alternatively, you can make the order less permanent by providing an alias or function which changes your path to the Heroku-preferred one only for the current session.
Keep in mind that the files that get run by bash
are a complex matter. .bashrc
is run for interactive, non-login shells so may not run in all cases (I, for one, fix that by calling .bashrc
at the end of my .bash_profile
though some people may cringe at that).
You're probably better off setting (and exporting) the path in your .bash_profile
.
And, if there is something wrong with what you're doing (your syntax seems fine but there may be other problems we cannot discern due to lack of information), you should perform the following steps:
echo $PATH
before and after each export
command to see if something is stuffing it up.