Link to home
Start Free TrialLog in
Avatar of Marthaj
MarthajFlag for United States of America

asked on

Ubuntu 18.04 and Exporting Path error

I installed msodbcsql17 and mssql-tools on a Ubuntu 18.04 server.

Everything went seemed okay.

But when I log into the terminal, I receive the following message:

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

Open in new window

And this is the command that is causing the problem:


echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc source ~/.bashrc

Open in new window

I checked to see if the path - /opt/mssql-tools/bin  - existed and it does exist.


So i uninstalled the msodbcsql17 and mssql-tools, re-installed them and used the export command again. 

Now I have the error message showing twice. 

So I examined the ~/ .bashrc using sudo.

At the bottom of the file, I found this:

export PATH="$PATH:/opt/mssql-tools/bin" source /home/ubuntu/.bashrc
export PATH="$PATH:/opt/mssql-tools/bin"
export PATH="$PATH:/opt/mssql-tools/bin"
export PATH="$PATH:/opt/mssql-tools/bin"
export PATH="$PATH:/opt/mssql-tools/bin" source /home/ubuntu/.bashrc

Open in new window


Is it safe to delete the offending lines that have source /home/ubuntu/.bashrc  and the duplicates and just have 1 of the export path ??

Any help appreciated, thank you.





Avatar of rindi
rindi
Flag of Switzerland image

I'm not an mssql user & therefore don't know anything about that. But is your user name actually "ubuntu" or something else? To me ubuntu seems unlikely, & that would also explain errors you get with /home/ubuntu..., as that directory may not exist.
Avatar of skullnobrains
skullnobrains

there should be a line break before "source"


echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Noah
Noah
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Marthaj

ASKER

Thank you for responding.

rindi - ubuntu is the default for the ubuntu distro. 

Noah - That is exactly what I thought too. I removed the duplicates and the source /home/ubuntu/.bashrc - no more error!

skullnobrains - I corrected the missing line break.

Thank you all for responding.

Here is a short list of AWS distros and default usernames:

RHEL            ec2-user
Debian          admin
Ubuntu          ubuntu
Fedora          fedora
Amazon Linux    ec2-user
SUSE            root
Centos          centos
BitNami         bitnami
TurnKey         root
NanoStack       ubuntu
OmniOS          ec2-user

Open in new window