Re: [JSch-users] JSch Exec and the remote users environment
Status: Alpha
Brought to you by:
ymnk
From: Mr M. <ya...@lu...> - 2007-03-31 17:59:08
|
> Hmm... I'm still confused (sorry). How does that reconcile with this code > from the Exec.java example? > > String command=JOptionPane.showInputDialog("Enter command", > "set|grep SSH"); > > Channel channel=session.openChannel("exec"); > ((ChannelExec)channel).setCommand(command); > > It sure seems like whatever input the user gives is captured as a string > and > passed directly to the channel without modification into a set of > character > arrays. In my code (not handy now, but I can post it on Monday), I'm > doing > essentially the same thing. Also, why would double-double quoting make > the > string work? Sorry I was thinking in C not java. OK second guess: Something somewhere is already putting one set of quotes in. Adding more quotes unquotes the first set. i.e. "ls -l" is a single command no arguments and ""ls -l"" is a command with one argument The double quotes are used to escape things in the shell in this case a space. Two quotes in a row escape what's in between i.e. nothing Try this on a shell and you should see this behaviour. Also "ls" has the expected behaviour but "ls " wont work. Have you tried printing out the command to check what the string is? -- M |