Timeline for I want to pass stdin to a bash script to an python script called in that bash script
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 18, 2019 at 11:01 | vote | accept | nanitous | ||
| Sep 12, 2019 at 1:13 | comment | added | cas | the entire purpose of the OP's script is to set up the environment for python and then pass stdin to main.py, so anything that did that would be breaking it. | |
| Sep 11, 2019 at 18:16 | comment | added | Ti Strga |
If other commands earlier in the script need to consume stdin (future edits to the script, etcetera), some operating systems have pseudo-filenames that can be passed around as placeholders. Under many flavors of Linux, for example, /dev/stdin is a device file (or a symlink to such) that will Do The Right Thing when read from. The tradeoff, of course, is that portability is limited to the operating systems whose special names you know, e.g., assigning a local variable to the appropriate fake filename and then using the variable as argument to python main.py.
|
|
| Sep 11, 2019 at 9:40 | comment | added | nanitous | The edit took me more than 6 min ;-) | |
| Sep 11, 2019 at 9:30 | comment | added | nanitous | HI @cas Thanks for the extensive answer. And, yes it works as it should. I've extended my question to make clear in which context I'm trying to use it and where it doesn't work. May be then this SE is the wrong forum to ask the question. | |
| Sep 11, 2019 at 5:06 | history | edited | cas | CC BY-SA 4.0 |
added 21 characters in body
|
| Sep 11, 2019 at 4:53 | history | edited | cas | CC BY-SA 4.0 |
deleted 3 characters in body
|
| Sep 11, 2019 at 4:47 | comment | added | cas | awww...the kitty's so cute, it has its own shebang line. | |
| Sep 11, 2019 at 4:45 | history | answered | cas | CC BY-SA 4.0 |