0
-bash: /root/.bashrc: line 100: syntax error near unexpected token `('
-bash: /root/.bashrc: line 100: `export PATH=/bin/lscript:/bin/lscript:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_1804.2019.521.0_x64__79rhkp1fndgsc:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/ProgramData/Oracle/Java/javapath:/mnt/c/Program Files (x86)/Intel/TXE Components/iCLS/:/mnt/c/Program Files/Intel/TXE Components/iCLS/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/Program Files/Intel/TXE Components/DAL/:/mnt/c/Program Files (x86)/Intel/TXE Components/DAL/:/mnt/c/Program Files/Intel/TXE Components/IPT/:/mnt/c/Program Files (x86)/Intel/TXE Components/IPT/:/mnt/c/Program Files/Intel/WiFi/bin/:/mnt/c/Program Files/Common Files/Intel/WirelessCommon/:/mnt/c/Program Files (x86)/GtkSharp/2.12/bin:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/QuickTime/QTSystem/:/mnt/c/Program Files/PuTTY/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Git/mingw64/bin:/mnt/c/Program Files/Git/usr/bin:/mnt/c/Users/User/AppData/Local/Microsoft/WindowsApps:/snap/bin'
pLumo
  • 26,204
  • 2
  • 57
  • 87
shArk
  • 1
  • 1
  • 1
  • 3
    The shell sees `export PATH=somethingsomething (x86)something` and compains, rightfully. Get in the habit of quoting strings which may contain spaces and other caracters which are special to the shell. – AlexP Oct 05 '19 at 12:31
  • You've incorrectly modified your PATH statement and added an invalid path to some Windows directories. Not a good idea to mount your Windows C: drive and then access from Ubuntu anyway. – heynnema Oct 05 '19 at 14:34
  • It seems you're using WSL. – Kulfy Oct 05 '19 at 14:41

1 Answers1

0

You have unquoted spaces in your value to be assigned. bash uses spaces to tell where one parameter ends and the next starts, and treats parenthesis ("()") as special. Thus,

export PATH=/bin/lscript:/bin/lscript:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_1804.2019.521.0_x64__79rhkp1fndgsc:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/ProgramData/Oracle/Java/javapath:/mnt/c/Program Files (x86)/Intel/TXE Components/iCLS/:/mnt/c/Program Files/Intel/TXE Components/iCLS/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/Window`sPowerShell/v1.0/:/mnt/c/Program Files/Intel/TXE Components/DAL/:/mnt/c/Program Files (x86)/Intel/TXE Components/DAL/:/mnt/c/Program Files/Intel/TXE Components/IPT/:/mnt/c/Program Files (x86)/Intel/TXE Components/IPT/:/mnt/c/Program Files/Intel/WiFi/bin/:/mnt/c/Program Files/Common Files/Intel/WirelessCommon/:/mnt/c/Program Files (x86)/GtkSharp/2.12/bin:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/QuickTime/QTSystem/:/mnt/c/Program Files/PuTTY/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Git/mingw64/bin:/mnt/c/Program Files/Git/usr/bin:/mnt/c/Users/User/AppData/Local/Microsoft/WindowsApps:/snap/bin

looks like 32 parameters to bash's assignment.

There are two solutions:

  1. Escape each space or parenthesis with \.
  2. Quote (" or ') each space-containing parameter.

Here's what using the first method gives:

export PATH=/bin/lscript:/bin/lscript:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program\ Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_1804.2019.521.0_x64__79rhkp1fndgsc:/mnt/c/Program\ Files\ \(x86\)/Common\ Files/Oracle/Java/javapath:/mnt/c/ProgramData/Oracle/Java/javapath:/mnt/c/Program\ Files\ \(x86\)/Intel/TXE\ Components/iCLS/:/mnt/c/Program\ Files/Intel/TXE\ Components/iCLS/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/Program\ Files/Intel/TXE\ Components/DAL/:/mnt/c/Program\ Files\ \(x86\)/Intel/TXE\ Components/DAL/:/mnt/c/Program\ Files/Intel/TXE\ Components/IPT/:/mnt/c/Program\ Files\ \(x86\)/Intel/TXE\ Components/IPT/:/mnt/c/Program\ Files/Intel/WiFi/bin/:/mnt/c/Program\ Files/Common\ Files/Intel/WirelessCommon/:/mnt/c/Program\ Files\ \(x86\)/GtkSharp/2.12/bin:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program\ Files\ \(x86\)/QuickTime/QTSystem/:/mnt/c/Program\ Files/PuTTY/:/mnt/c/Program\ Files/Git/cmd:/mnt/c/Program\ Files/Git/mingw64/bin:/mnt/c/Program\ Files/Git/usr/bin:/mnt/c/Users/User/AppData/Local/Microsoft/WindowsApps:/snap/bin

And, for the second method,

export PATH=/bin/lscript:/bin/lscript:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:"/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_1804.2019.521.0_x64__79rhkp1fndgsc":"/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath":/mnt/c/ProgramData/Oracle/Java/javapath:"/mnt/c/Program Files (x86)/Intel/TXE Components/iCLS/":"/mnt/c/Program Files/Intel/TXE Components/iCLS/":/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:"/mnt/c/Program Files/Intel/TXE Components/DAL/":"/mnt/c/Program Files (x86)/Intel/TXE Components/DAL/":"/mnt/c/Program Files/Intel/TXE Components/IPT/":"/mnt/c/Program Files (x86)/Intel/TXE Components/IPT/":"/mnt/c/Program Files/Intel/WiFi/bin/":"/mnt/c/Program Files/Common Files/Intel/WirelessCommon/":"/mnt/c/Program Files (x86)/GtkSharp/2.12/bin":/mnt/c/WINDOWS/System32/OpenSSH/:"/mnt/c/Program Files (x86)/QuickTime/QTSystem/":"/mnt/c/Program Files/PuTTY/":"/mnt/c/Program Files/Git/cmd":"/mnt/c/Program Files/Git/mingw64/bin":"/mnt/c/Program Files/Git/usr/bin":/mnt/c/Users/User/AppData/Local/Microsoft/WindowsApps:/snap/bin
karel
  • 110,292
  • 102
  • 269
  • 299
waltinator
  • 35,099
  • 19
  • 57
  • 93
  • Parentheses must also be escaped in the first method I think? that's why the error is `unexpected token '('` rather than something like `'/mnt/c/Program': No such file or directory` – steeldriver Oct 05 '19 at 14:55