The equivalent of running in a Terminal is to run it in a shell. Try the following code:OSSUnixSubprocess new
�� �� �� �� command: '/bin/bash';
�� �� �� �� arguments: #('-c' 'ls /');
�� �� �� �� redirectStdout;
�� �� �� �� runAndWaitOnExitDo: [ :process :outString�� |
�� �� �� �� �� �� �� �� outString inspect
�� �� �� �� ].
OSSUnixSubprocess new
�� �� �� �� command: '/bin/bash';
�� �� �� �� arguments: #('-c' 'ls / | grep bin');
�� �� �� �� redirectStdout;
�� �� �� �� runAndWaitOnExitDo: [ :process :outString�� |
�� �� �� �� �� �� �� �� outString inspect
�� �� �� �� ].You���ll need to be careful to properly shell escape the shell command arguments if they are not hard coded (especially things like file names from users). HTH. ���YanniOn Mon, Jun 6, 2022 at 7:51 AM <vinref@gmail.com> wrote:Hi
I tried something similar on (X)ubuntu using this:
OSSUnixSubprocess newcommand: '/bin/ls';arguments: #('-la' '/tmp/' '|' '/usr/bin/grep unix');redirectStdout;runAndWaitOnExitDo: [ :process :outString |outString inspect]
and looking at the output in xtrerm I got a message like this:
/bin/ls: cannot access '|': No such file or directory/bin/ls: cannot access '/usr/bin/grep unix': No such file or directory.
So I think it regards anything after the first item in the arguments as a file or directory.
This means you will have to write a bash script instead. So I wrote a script called my_grep:
#!/bin/bashcd $1ls -la | grep unixand called it with:
OSSUnixSubprocess newcommand: '/tmp/my_grep';arguments: #('/tmp');redirectStdout;runAndWaitOnExitDo: [ :process :outString |outString inspect]and it worked.
Vince