Re: lc shell and command line

2011-11-19 Thread Peter Alcibiades
Roger Eller wrote: > > How about this method? > > shell("pw=" & tPassword & "; echo $pw | sudo -S command") > > SOURCE: > http://www.mail-archive.com/use-revolution@.runrev/msg137100.html > > ~Roger > Yes very neat, thanks. My problem was a bit different but maybe this can be used. The rea

Re: lc shell and command line

2011-11-18 Thread Roger Eller
On Fri, Nov 18, 2011 at 1:00 PM, Andre Garzia wrote: > Roger, > > Good finding. > > Cheers > andre > > I keep the classic Revolution archive, as well as the new LiveCode archive links handy for searching. There's lots of good stuff in both. It's too bad the Developer List is private, and therefo

Re: lc shell and command line

2011-11-18 Thread Andre Garzia
Roger, Good finding. I gave the same comment as before lol... it appears that this solution works, I haven't tested it. Cheers andre On Fri, Nov 18, 2011 at 3:48 PM, Roger Eller wrote: > On Fri, Nov 18, 2011 at 12:26 PM, Andre Garzia wrote: > > > As far as I know, you can't ask for the user pas

Re: lc shell and command line

2011-11-18 Thread Roger Eller
On Fri, Nov 18, 2011 at 12:26 PM, Andre Garzia wrote: > As far as I know, you can't ask for the user password and pass it to a > shell call with clever use of pipes. That is not how sudo works, you can't: > > cat password.txt | sudo cd .. or sudo cd .. < password.txt > > How about this method

Re: lc shell and command line

2011-11-18 Thread Andre Garzia
Guys, As far as I know, you can't ask for the user password and pass it to a shell call with clever use of pipes. That is not how sudo works, you can't: cat password.txt | sudo cd .. or sudo cd .. < password.txt The only way I found to script sudo calls is by using expect ( http://www.nist.

Re: lc shell and command line

2011-11-18 Thread Mike Bonner
set the hideconsolewindows to true will do what you wish. On Fri, Nov 18, 2011 at 9:27 AM, John Brozycki wrote: > Regarding shell commands and LiveCode > > I've noticed that under OS X, invocation of a shell command is silent. > But under Windows, you see a CMD window quickly pop up and dis

Re: lc shell and command line

2011-11-18 Thread Mark Schonewille
John, set the hideConsoleWindows to true -- Best regards, Mark Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://economy-x-talk.com Twitter: http://twitter.com/xtalkprogrammer KvK: 50277553 Become our partner in sales http://qery.us/1bq Start selling Color Convert

Re: lc shell and command line

2011-11-18 Thread John Brozycki
Regarding shell commands and LiveCode I've noticed that under OS X, invocation of a shell command is silent. But under Windows, you see a CMD window quickly pop up and disappear. I haven't found any options to prevent the shell command popping up under Windows, but wondered if anyone knew

Re: lc shell and command line

2011-11-14 Thread Mark Wieder
Mike- Monday, November 14, 2011, 2:06:34 PM, you wrote: > Hmm, would calling login directly work? Probably not, as on many systems > root login is not allowed. If it were allowed, then the same basic idea > works. open process login then do the magic stuff, then exit out. It's not allowed, or

Re: lc shell and command line

2011-11-14 Thread Mike Bonner
oh that sucks. I tried quite a few other methods none of which worked very well if at all. Hmm, would calling login directly work? Probably not, as on many systems root login is not allowed. If it were allowed, then the same basic idea works. open process login then do the magic stuff, then exit

Re: lc shell and command line

2011-11-14 Thread Mark Wieder
Mike- Monday, November 14, 2011, 12:16:39 PM, you wrote: > open elevated process seems to work ok. The following handler, opens bash > as an elevated process, then writes to it and reads from it. Should be > possible to run a pre-made shell script too. That's a nice script. Unfortunately openin

Re: lc shell and command line

2011-11-14 Thread Mike Bonner
open elevated process seems to work ok. The following handler, opens bash as an elevated process, then writes to it and reads from it. Should be possible to run a pre-made shell script too. Yep, just tried it works fine. Notice the "whoami" command that is written, it confirms that using open ele

Re: lc shell and command line

2011-11-14 Thread J. Landman Gay
On 11/14/11 11:03 AM, Peter Alcibiades wrote: My second problem with livecode was how to call the shell in such a way as to have the user enter the password and then carry on with the script. I probably shouldn't post about something I know so little about, but... If you know you will need a p

Re: lc shell and command line

2011-11-14 Thread Mike Bonner
Don't forget you can open a script as a process for update and then send whatever you need to it directly from livecode. I also seem to recall that its possible to open a process with elevated privileges but I can't find the info on that for some reason. If you can figure out that portion it could

Re: lc shell and command line

2011-11-14 Thread Peter Alcibiades
Thanks guys. Yes, I know about sudo. The idea was to get the user to put in the root password on each occasion, not to store it someplace which you're quite right of course would be very unwise. I think maybe livecode is not what I should be using for this, the right way is probably to have a sh

Re: lc shell and command line

2011-11-14 Thread Mike Bonner
if I recall correctly, you can grab a password from a file (as bd stated, this is dangerous) sudo su < filewithpword.txt; command 1; command 2; etc 3 scary thing to do though. On Mon, Nov 14, 2011 at 8:31 AM, Bernard Devlin wrote: > It may be that the easiest way around that is to edit /etc/su

Re: lc shell and command line

2011-11-14 Thread Bernard Devlin
It may be that the easiest way around that is to edit /etc/sudoers and configure some username, such that said the logged-in user does not need to enter a password in order to call 'sudo su - auser'. If you look inside /etc/sudoers it should explain what is required to make access to sudo password

Re: lc shell and command line

2011-11-14 Thread Mike Bonner
you can use a semicolon as command delimiter. So you could do shell("command 1; command 2; command 3") and it would do them in succession. However rather than su to root its a much better idea to use sudo. Beyond that, it might be easier to use open process so that you can open a persistant conne

Re: lc shell and command line

2011-11-14 Thread Peter Alcibiades
Bernard, many thanks, yes, that works. Can I ask one more question, how then would you get the shell to interact, like if you do su and want to get the password in, and then run a script that requires root password? Or maybe all that has to be done in shell? Peter -- View this message in contex

Re: lc shell and command line

2011-11-14 Thread Bernard Devlin
put shell("cd ..; pwd") would appear to do what you want. There is going to be no state maintained between different calls of shell(). Thus, changing to a directory in one calls is not (IMO) going to be maintained on a subsequent call of shel|(). Concatenating commands (as I did above using the

Re: lc shell and command line

2011-11-14 Thread Peter Alcibiades
I'm having trouble with the livecode shell and cd command also. pwd in a terminal does: :~/ runrev 4.5/livecode-4.5.2$ cd .. :~/ runrev 4.5$ pwd runrev 4.5$ If you do the exact same things using put shell(""), this doesn't work. In particular, put shell("pwd")