1

I am trying to make a link to Notepad++ in Cygwin but I face the following error:

KD@HPi7 /home/kd/ns-allinone-2.35
$ ln /cygdrive/c/Program\ Files\ \(x86\)/Notepad++/notepad++.exe np
ln: failed to create hard link ‘np’: File exists

KD@HPi7 /home/kd/ns-allinone-2.35
$ np
-bash: syntax error near unexpected token `x86\)/Notepad++/notepad++.exe'

I have no clue why it issues the error because the path I entered for Notepad++ is what auto-completing via Tab key gives me in Cygwin command line. So, where might the problem be?

2 Answers 2

0

Where might the problem be?

ln /cygdrive/c/Program\ Files\ (x86)/Notepad++/notepad++.exe np

The above command will not work as you also need to escape ( and ) that have a special meaning to bash.

  • Bash sees the ( as introducing a list of commands.
  • Placing a list of commands between parentheses causes a subshell to be created, and each of the commands in list to be executed in that subshell. Since the list is executed in a subshell, variable assignments do not remain in effect after the subshell completes.
  • Bash tries to execute x86

The following should work:

ln /cygdrive/c/Program\ Files\ \(x86\)Notepad++/notepad++.exe np

Further Reading

0

i just used an alias

alias np="/cygdrive/c/Program\ Files\ \(x86\)/Notepad++/notepad++.exe"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .