1

I need to add permanent alias for bash terminal so that I don't have to set them always after logging in.

I am adding alias command to .bashrc and trying to install the .bashrc file again using the source command.

pxxxxx@pxxxxx:~$ cat .bashrc | tail -2
alias name1='command1'
alias name2='command2'
pxxxxx@pxxxxx:~$ 

pxxxxxx@pxxxxxx:~$ cat .bashrc | grep export
export EDITOR='vi'
export SHELL= /usr/bin/bash

Now,​ whenever I am logging in into bash or running the following command:

$source .bashrc

I am getting the following error:

pxxxxx@xxxxxx:~$ source .bashrc 
bash: export: `/usr/bin/bash': not a valid identifier
Ashish Pratap
  • 439
  • 5
  • 21
  • The error you have seen is with an export, but the sample of the .bashrc you shared hasn't got any exports in it, can you grep your file for export and confirm if there any results? – Rumbles May 15 '19 at 10:04
  • "grep export .bashrc" would be the easier way of doing it, but would work in the same way... I'm not sure then, unless your bashrc in turn sources another file which has an export in it? – Rumbles May 15 '19 at 10:13
  • What do you get when you `echo $PATH` and `which bash`? – MarkJL May 15 '19 at 10:28

1 Answers1

2

I think the issue is with your second export: you say it looks like:

export SHELL= /usr/bin/bash

Try changing it to read:

export SHELL="/usr/bin/bash"

The space after the equals would break setting it as a variable. The quotes aren't necessary, but help stop word splitting.

I can't reproduce the error you're having, but when I try to source a .bashrc with that in there it just fails to return.

Rumbles
  • 1,367
  • 3
  • 16
  • 40