How to pass a piped cmd to the $ZF(-100, function
Unix: I'm trying to switch to using the $ZF(-100 function in place of $ZF(-1. I have it working for a simple, single, cmd, but can't figure out how to pass a piped sequence. Maybe this just isn't allowed?
For example:
S sc=$ZF(-1,"ps -Af | grep username")
works, but I can't figure out how to format this for the $ZF(-100 function.
???
Thanks
Comments
set cmd = "ps"
set arg = 4
set arg(1) = "-Af"
set arg(2) = "|"
set arg(3) = "grep"
set arg(4) = "username"
set sc = $zf(-100, "/SHELL", cmd, .arg)Alternatively you can wrap it in brackets
$zf(-100,"/SHELL", "(ps -Af | grep username)" ,"")
It somewhat defeats the purpose of $zf(-100).
Parametrized commands are generally better.
A valid point but it can depend on how the command string is formed in the first place, unless you write a parser to break a command string down into a command plus arguements. I agree that you may as well use $zf(-1 but as the documentation will point you to use $zf(-100 then it can be valid.
It's also usefull to know you can use brackets in this way for general knowledge.