3

I am trying to sign onto the bash Windows Subsystem for Linux when I get this error:

-bash: /home/User1/.profile: line 28: syntax error near unexpected token `('

Before getting this error I was trying to permanently put a directory in my path using the export PATH:$PATH function.

my /.profile file

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi
export PATH=/home/user1/.local/bin:/home/janeen/bin:/home/janeen/miniconda3/bin:/home/User1/miniconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/c/ProgramData/DockerDesktop/version-bin:/c/Program Files/Docker/Docker/resources/bin:/c/Program Files (x86)/Common Files/Oracle/Java/javapath_target_34052312:/c/Windows/System32:/c/Windows:/c/Windows/System32/wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Strawberry/c/bin:/c/Strawberry/perl/site/bin:/c/Strawberry/perl/bin:/c/Users/User1/AppData/Local/Programs/Python/Python36:/c/Users/Janeen/AppData/Local/Programs/Python/Python36/Scripts:/c/Users/User1/AppData/Local/Programs/Python/Python37-32/Scripts:/c/Users/Janeen/AppData/Local/Programs/Python/Python37-32:/c/Users/User1/AppData/Local/Microsoft/WindowsApps:/e/Program Files (x86)/TBtools/bin:/snap/bin:/software/samtools
  • 1
    is there a reason you do not include the contents of /home/User1/.profile? and more specifically the lines around line 28? It is going to be pretty impossible to answer this without ... – Rinzwind Oct 24 '19 at 6:20
  • Your export command is incorrect. You need to use export PATH=/some/new/path:$PATH where you assign new value to the PATH variable and export it simultaneously. But the cited syntax error, probably, is related to some other typo. – pa4080 Oct 24 '19 at 7:11
  • now the error is resolve but I am having this error now -bash: /home/janeen/.profile: Permission denied when typing bash at the comment line – Jane1989 Oct 24 '19 at 7:54
1

First, you need to quote the directory paths that include white spaces and special characters, or escape each of these characters by back slash - reference.

Second, the canonical way to change the PATH is:

export PATH=/some/new/path:$PATH

Thus you are adding some new path in front to the existing value of PATH, otherwise you wont be able to execute fluently couple of commands that are located in the default path.

Third within WSL, by default, the Windows drives C:, D: and so on, are mounted under /mnt - i.e. /mnt/c, /mnt/d, etc. Here is example:

export PATH='/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath_':$PATH

Forth, there shouldn't be available file /.profile, it must be located in the users home directory ~/.profile ($HOME/.profile). Also your .profile file looks incomplete here is how the default one looks like: WSL .profile. In the profile file that is posted within the question the .bashrc file is not sourced.

| improve this answer | |
  • Hello thanks but this my path within my /.profile. When I type echo $PATH the software/samtools is not there. Also its now showing a permission denied for /.profile and the user, directory name and host name of my bash subsystem has not color, but if I type bash again the blue and green colors return. – Jane1989 Oct 24 '19 at 8:25
  • Hi, @Jane1989, I've updated the answer. – pa4080 Oct 24 '19 at 8:52
  • is it incomplete because of the last line does not have a fi – Jane1989 Oct 24 '19 at 8:54
  • Thank you much for your help but what do you mean by the .bashrc file is not source. I am very new to linux so I am not familiar with these statements. also I did you way for the export file and still not after login again not showing in the path. – Jane1989 Oct 24 '19 at 8:56
  • @Jane1989: This is how the .profile file looks like on my WSL: paste.ubuntu.com/p/Np6p6YNd2p ... There is a line . "$HOME/.bashrc", here is reference: bash.cyberciti.biz/guide/Source_command – pa4080 Oct 24 '19 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.