0

I have used this link for preventing programs use the Internet connection on Ubuntu/Linux.

However I still can't complete the last step as shown:

$ ni wine C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe
bash: syntax error near unexpected token `('
$ ni "wine C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe"
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `wine C:\Program Files (x86)\Foxit Software\Foxit    Reader\FoxitReader.exe'
$ ni wine "C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe"
Usage: wine PROGRAM [ARGUMENTS...]   Run the specified program
       wine --help                   Display this help and exit
       wine --version                Output version information and exit
$ ni wine FoxitReader.exe
Usage: wine PROGRAM [ARGUMENTS...]   Run the specified program
       wine --help                   Display this help and exit
       wine --version                Output version information and exit

2 Answers 2

2

Syntax errors means that the shell has trouble interpreting your commands. This is a result of the fact that the shell splits words based on spaces when it parses a command line. Without quotes, each individual part of the argument (such asC:\Program) is treated as a separate argument by itself. You can use quotes to prevent the word splitting:

ni wine "C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe"

This passes two arguments to the ni command: wine and the full Windows path for FoxitReader.

When you tried placing the opening double quote before wine, the shell treated the whole lot of wine C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe as one argument for the ni command.

If you want to avoid similar issues in the future, I’d recommend checking Greg’s wiki for an in-depth explanation on how the shell deals with spaces. You may not understand it all but you should still learn why, when and how to avoid word splitting problems.

1

What Anthony said is true, you can use "" to say the whole path is a string, but maybe this is worth a consideration, as with this method yo ucan use to complete your paths: There are many special characters in a unix terminal, including spaces,*,newlines and other. You can ignore them by typing a "\" before them. So if a folder is named "My test", u can either use cd "My test", or cd My\ test, which you can complete. But in wine you'll probably have to use the Michaelsoft Binbows convention "".(no offense, just Microsoft jokes :D )

"Protip :D" Sometimes you may want for some reason write a "\" character. To write it, you have to protect it, so you put another "\" before it. So if you want to write "Protected character \" you actually do echo Protected character \\. Note that echo takes string arguments so you don't have to protect the space.

Hope it helps :)

You must log in to answer this question.

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