Istvan Gabor wrote:
Thank you all for you fast replies.
On Mon, 06 Apr 2020 18:09:01 +0200, Per Jessen wrote:
Istvan Gabor wrote:
Hello:
I have a program that can send its output to a script. I can setup the script command in the program as: <script-name> option1 option2 ..., eg: myscript.sh name time.
Aha, you have to provide a script and your program will then run that ?
Yes. It seems you are the only one who understood / found out what I meant. For the clarity: I have a script. The program will call/run that script. The program provides the script with input data. What I did not know how I refer in the script to the input data. In other words how can I "tell" the script that your input you should work on is provided by the program that called you.
In such a setup, the only way is to pipe the output from 'program' to 'script', the output sent to your script is then available as stdin.
In the meantime I found that the program sends postscript data for printing. I want to save the original postscript file, modify postscript data and print it.
that could look something like this: myscript.sh: tee original.ps | ( modify the data modify the data some more ) | lp -
This is what I meant: if I use in my script "cat > file", will the standard input be emptied or remains for a next call?
Ah I see. That is what 'tee' is for - it writes the output to a file and to stdout.
My question is how I can "store" the input data in the script for using it again. I want to modify the data (eg by pstops). Can I save it in a variable or do I have to write it to a temporary file?
Personally, I would write it to a file, as in my example above. I prefer to only keep relatively small amounts of data in variables. -- Per Jessen, Zürich (10.2°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org