problem with shell.execute()

I am trying to run a command with shell.execute() and am having a problem with a path which has an item that includes a space character in its name. (Application Settings)

Here is the code:

dim doFingCommand as string doFingCommand = "sudo fing -r1 -otable,html,$HOME/Library/Application\\ Support/fingWrap/mylan.html" mainWindow.sh.Execute(doFingCommand)

I seems the shell.execute is not recognizing the backslash as an escape character. I have also tried removing the escape slash per suggestion of Xojo support, but that does not work either.

Any ideas how to format this so the shell command will not fail?

Maybe this:

doFingCommand = “sudo fing -r1 -otable,html,”+chr(34)+"$HOME/Library/Application Support/fingWrap/mylan.html"+chr(34)

[quote=50881:@Javier Vazquez Muñoz]Maybe this:

doFingCommand = “sudo fing -r1 -otable,html,”+chr(34)+"$HOME/Library/Application Support/fingWrap/mylan.html"+chr(34)[/quote]

Hmm… Good idea but did not work. The following also did not work:

Backslash added:

doFingCommand = "sudo fing -r1 -otable,html,"+chr(34)+"$HOME/Library/Application\\ Support/fingWrap/mylan.html"+chr(34)
doFingCommand = "sudo fing -r1 -otable,html,$HOME/Library/Application" + chr(92) + " Support/fingWrap/mylan.html"

is sudo asking for permissions perhaps ?

Yes, but I have that handled. This is after password has been passed to the shell.

I am getting closer. The following does not work, but at least it does not throw an error.

doFingCommand = “sudo fing -r1 -otable,html,~/Library/Application” + chr(20) + “Support/fingWrap/mylan.html”

I can see the command running in the shell as:
sudo fing -r1 -otable,html,~/Library/Application^TSupport/fingWrap/mylan.html

Are you doing

execute
execute
execute

if so the anything set up in the first execute is NOT retained by the second one

[quote=50919:@Norman Palardy]Are you doing

execute
execute
execute

if so the anything set up in the first execute is NOT retained by the second one[/quote]
I am only using a single execute, Using interactive mode. On the data received event, if the data shows it is asking for a password, the password is written to the shell object. This method is working fine if I use a path which does not have a space character. When the command sees the space it thinks it is a new argument/flag for the command. See the error below.

  • Error: unable to parse discovery output argument
    in argument ‘Support/fingWrap/mylan.html’: too few parameters

OK
Just wanted to rule out the obvious

But you shouldn’t have to use the " and \
One or the other
for instance
sudo ls -al “$HOME/Library/Application Support/”
here gives me a full listing
BUT
sudo ls -al “$HOME/Library/Application\ Support/”
gives
ls: /Users/replaced/Library/Application\ Support/: No such file or directory

Is FING something you’ve written & can get it to just dump the cmd parameters it received ?
It seems it thinks thats a new parameter

Thanks Norman. This does seem to be an issue with Fing itself. I get the same error when I run it directly in the command line.
Fing is from Overlook http://www.overlooksoft.com