Question getting an progress error when i try to run Unix Comment in progress editor

getting an progress error when i try to run Unix Comment in progress editor
ps -aefx | grep 20816 | grep _progres | awk '{print $1 }' - basically, this comment is used to get userid from PID but it got a progress error..
error detail: looks print is a progress keyword
x x** "print" was not found. (293) x
x x** x
x x Could not understand line 1. (193) x

also I tried with unix slient value("ps -aefx | grep 20816 | grep _progres | awk '{print $1 }'")
 

Cringer

ProgressTalk.com Moderator
Staff member
I think { is the problem.
Try:
unix slient value("ps -aefx | grep 20816 | grep _progres | awk '~{print $1 }'")
 
Hi Cringer, thanks for your note. Further I also need to assign the output of the above unix silent value into a variable. So that I can display it in a report. It is not allowing to assign directly. Any other option there?
 

Attachments

  • 31FC5DD5-BBE0-4FB0-88DB-86DB171E98C8.jpeg
    31FC5DD5-BBE0-4FB0-88DB-86DB171E98C8.jpeg
    169 KB · Views: 5

RealHeavyDude

Well-Known Member
In order to get the output of an os command into a variable you need to use the input through. I don't have any example at hand right now, but if you lookup the online help you will find an example. There is one caveat though, the character variable's format must be large enough to hold the result, otherwise it will be truncated.
 

Cringer

ProgressTalk.com Moderator
Staff member
The alternative to RHD's suggestion is to pipe the output to a file and then to read the contents of the file for your response.
 

TomBascom

Curmudgeon
IMPORT UNFORMATTED eliminates the format problem. The "downside" is that you get the whole line rather than individual space delimited variables which means you lose the parsing of the line. OTOH that isn't hard to do and if you have input of uncertain size you probably wanted the whole line in one gulp anyway.
Code:
input through value( "something" ).
import unformatted lineText.
input close.
 
Top