This message showed when I opened the terminal. I downloaded Ubuntu 20.04 LTS on Windows10 Linux subsystem. Help pls!
-bash: /home/rafsan/.bash_profile: line 1: syntax error near unexpected token `('
-bash: /home/rafsan/.bash_profile: line 1: `export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu20.04onWindows_2004.2021.825.0_x64__79rhkp1fndgsc:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/ProgramData/Oracle/Java/javapath:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/D3DGear:/mnt/c/Users/rafsa/AppData/Local/Programs/Python/Python39/Scripts/:/mnt/c/Users/rafsa/AppData/Local/Programs/Python/Python39/:/mnt/c/Users/rafsa/AppData/Local/Microsoft/WindowsApps:/mnt/c/Program Files/JetBrains/PyCharm 2021.1/bin:/mnt/c/Python39/Scripts:/snap/bin'
After reformatting your question with <code>...</code> tags, we see that an initial login instance of bash
(that's what the first "-
" says, see man bash
) has a problem with line 1 of .bashrc
. It then shows us that line, the overly long "PATH
" setting.
Linux shells use the ASCII "space" character as an argument separator, and "()
" for subshells.
There are more of these "Special Characters", see https://mywiki.wooledge.org/BashGuide/SpecialCharacters
To remove the "specialness" of these characters, put a backslash ("\
") in front of each.
E.g. replace Program Files (x86)
with Program\ Files\ \(x86\)
.
A better way to manipulate PATH
is with Stephen Collyer's bash_path_funcs, described in Linux Journal way back in 2000:
https://www.linuxjournal.com/article/3645 https://www.linuxjournal.com/article/3768 https://www.linuxjournal.com/article/3935
The addpath
function adds an entry to a path only if it is not there in the first place. delpath -n
deletes all non-existent directories from a path.
You can get the pathfunc.tgz
file from https://web.archive.org/web/20061210054813/http://www.netspinner.co.uk:80/Downloads/pathfunc.tgz