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. I guessed it should be some input/output redirection but all google results gave only command line examples where the input (standard input) was either a file or the terminal input. 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.
I know that I can get the options in the script using $1 and $2 etc.
But how can I get the program's output that is sent to the script? I would like to write to output to a file.
myscript.sh:
#!/bin/sh cat >file
Yes, this works. Based on this and Philippe's response I found I can do: cat > file cat - > file # - indicating standard input cat /dev/stdin > file Are these 3 equivalent?
I also would like to use the program's output to different purposes. Can I store it in a variable and use it later, or do I have to save it in a temporary file?
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? I tried to do this: cat > file cat > file2 file is the normal expected file but file2 is only an empty file. 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? Thanks again, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org