How to insert export line bashrc with Makefile - makefile

I would like to insert the following line in my .bashrc file through Makefile
export PATH="$HOME/.rbenv/bin:$PATH"
How can I do that?

You can do this using command:
#echo export PATH=$(HOME)/.rbenv/bin:$(PATH) >> ~/bashrc

Related

EC2 User data not formatting bash variables

I have a line in my ec2 instance user data that is seen below
cat <<EOT >> $HOME/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export HADOOP_HOME=$HOME/hadoop
export HADOOP_CONF=$HADOOP_HOME/etc
export PATH=$PATH:$JAVA_HOME:$HADOOP_HOME/bin
EOT
It is supposed to append to the ~/.bashrc file while inferring variable itself, but what is appended to the ~/.bashrc file looks like
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export HADOOP_HOME=/home/ubuntu/hadoop
export HADOOP_CONF=/etc
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin::/bin
The HADOOP_HOME variable works fine but the HADOOP_CONF and PATH variable is not what it supposed to be. My guess is it wasn't able to infer $HADOOP_HOME in both cases.
What can I do about this?
I've tried separating it like this
cat <<EOT >> $HOME/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export HADOOP_HOME=$HOME/hadoop
EOT
cat <<EOT >> $HOME/.bashrc
export HADOOP_CONF=$HADOOP_HOME/etc
export PATH=$PATH:$JAVA_HOME:$HADOOP_HOME/bin
EOT
I've also tried to surround the $HADOOP_HOME in quotes too

macOS 11.2.3 bashrc not reconizing common flags

I am trying to configure my terminal, but my .bashrc file is not recognizing the common flags.
Here is what my .bash_profile looks like:
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
This is what my .bashrc file looks like:
export PS1="\u#\h\w $ "
And this is what my command prompt looks at the end:
$ source .bashrc
\u#\h\w $
Please advise.
Thanks.
MacOS 11.2.3 defaults to the zsh shell so bash dotfiles and prompt formatting will not apply. Type ‘ps’ to verify which shell you are running.

bash: export: `/home/mohin/.bashrc': not a valid identifier

When I Open my terminal, it showing this line.
bash: export: `/home/mohin/.bashrc': not a valid identifier
mohin#mohin:~$
I am using Ubuntu 16.04.
I used this line of commend after that I am facing this trouble
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
I got this line from MEDIUM Post at the following link
https://medium.com/#rgdev/how-to-install-laravel-5-4-on-ubuntu-16-04-from-scratch-quickly-29375e18e7ca
I need to solve it. Please help me.
I just fix this issue by the following process.
I did this commend:
mohin#mohin:~$ grep -i export ~/.bashrc
After That, It shows the following info
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
export PATH="$HOME/.composer/vendor/bin:$PATH"
export PATH="$HOME/.composer/vendor/bin:$PATH"
export PATH="$HOME/.composer/vendor/bin:$PATH" source /home/mohin/.bashrc
export PATH="$HOME/.composer/vendor/bin:$PATH"
export PATH="$PATH:$HOME/.composer/vendor/bin"
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
over here I got the issue. I mean this line -
export PATH="$HOME/.composer/vendor/bin:$PATH" source
/home/mohin/.bashrc
I open .bashrc and remove this line by the following command -
sudo nano /home/mohin/.bashrc
That's it. issue fix.

export PATH=~/workspace/swift-dev/usr/bin:"${PATH}"

Taken from
https://swift.org/download/#linux
export PATH=/path/to/usr/bin:"${PATH}"
how come I have to do this every time!? every session it stops the path thing, is this because I have to have administrative privledges?
Try editing your .bashrc file and including the line:
export PATH=/path/to/usr/bin:"${PATH}"
then source your .bashrc with:
source ~/.bashrc
or:
. ~/.bashrc

How can I define my text editor in bashrc?

I'm trying to set a variable containing my editor in ~/.bashrc. Unfortunately it doesn't seem to be coming through
# ~/.bashrc
export EDITOR=sublime
in terminal:
source ~/.bashrc
echo $EDITOR
=> nothing
How can I set and persist this variable?
Edit
This is my current .bashrc file:
source ~/.profile # Get the paths
source ~/.bashrc # get aliases
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
export EDITOR=sublime
Depending on your OS, check your .bash_profile or /etc/bash.bashrc
If your .bashrc isn't sourced, your .bashrc isn't read. All you need to do is source your file or drop your export command in something that is.
The .bashrc is only read in when a new shell is created and not when you log in. If you want your .bashrc read in during logins, you have to add this line to your $HOME/.bash_profile or $HOME/.profile:
[ -x $HOME/.bashrc ] && . $HOME/.bashrc
Note that $HOME/.bashrc must be both readable and executable by the user. (i.e., the file permission must be 5.. or 7..) for it to work. Make sure that your file permissions are set correctly.

Resources