Hi Norbert,

On 24 Jul 2014, at 12:37, Norbert Hartl <norb...@hartl.name> wrote:

> What are you using to do jobs on the commandline. I'm sick of doing bash and 
> sed,perl,jq,... stuff. What would be the quickest start when using a normal 
> image? And what if I want to give coral a start. Does it work in 3.0? Best 
> place to load stuff from?
> 
> thanks,
> 
> Norbert

Actually, you need nothing more than a standard image to do the following:

#!/Users/sven/tmp/pharo4/pharo-vm/Pharo.app/Contents/MacOS/Pharo --headless 
/Users/sven/tmp/pharo4/Pharo.image st --quit
FileStream stdout nextPutAll: Smalltalk arguments printString; cr.
FileStream stdout nextPutAll: 42 factorial asString; cr.

Make sure to name the file .st and obviously change the paths involved.
You can write any Pharo code, access stdout, stderr, stdin, arguments.
With FileSystem you can do a lot of magic.

If you make the file executable, you can do:

$ ./test.st 
#('--quit' './test.st')
1405006117752879898543142606244511569936384000000000

HTH,

Sven

PS: the above invokes the STCommandLineHandler which does proper #shebang 
handling. Absolute paths are needed.



Reply via email to