Link | Shell_9 |
Author | Jonathan Guthrie |
Category | Technical |
Version | 9.x |
License | Public Domain |
Posted | 29 Sep 2010 |
Updated | 29 Sep 2010 |
More by this author... |
This is a simple wrapper for the [os_process] type that allows you to interact with a bash shell, similar to how you would if you were using Terminal on OS X. On Windows, it interacts with the cmd process. The tag creates a new [os_process] type, opens a new shell, and executes whatever command is passed to it.
local(x = shell('cd /path/to/file; chmod 664 helloworld.xml'))
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
// ================================== /* Adapted from Jason Huck's Shell tag from 8.5 */ // ================================== define shell(cmd::string) => { local(os = lasso_version(-lassoplatform)) local(this = file_forceRoot(response_Path)) #this->replace('//','/') if(#os >> 'Win') => { local(shell = os_process('cmd',(:'/c cd ' + #this + ' && ' + #cmd))) else(#os >> 'Mac') local(shell = os_process('/bin/bash', (:'-c','cd '+#this+'; '+#cmd))) else local(shell = os_process('/bin/sh', (:'cd '+#this+'; '+#cmd))) } local(out = #shell->readString) !#out->size ? #out = #shell->readerror #shell->close return(#out) }
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
This uses sys_process & lets you specify the user to run as