Timeline for Is it possible to pass environment variables from child to parent in user space? [duplicate]
Current License: CC BY-SA 4.0
23 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Oct 22, 2020 at 3:47 | history | edited | G-Man Says 'Reinstate Monica' | CC BY-SA 4.0 | Fixed capitalization; tweaked wording and formatting; added tag. |
| Oct 21, 2020 at 21:06 | comment | added | combinatorist | In case anyone's curious why you can't force a change in the parent environment when your child script is called with bash, it's for security and reliability. You don't want to just any script you call to mess up your current script's functioning. If you choose to source a script, that requires a higher level of trust and understanding about what it does. | |
| Oct 21, 2020 at 21:03 | comment | added | combinatorist | I think the key issue here is that the OP is looking for a way to do this without any work on the parent side. My suggestion just asks the user of the parent to call the script differently (with source instead of say, bash), which might count as work. | |
| Oct 21, 2020 at 21:02 | comment | added | combinatorist | Why is this a duplicate of unix.stackexchange.com/questions/38205/…. That answer is to change env variables in any other process, but this one is specifically for a child -> parent relationship. And if the parent calls the child in the right way (i.e. source as I answered above), then it should work. | |
| Oct 21, 2020 at 21:00 | review | Suggested edits | |||
| S Oct 22, 2020 at 3:47 | |||||
| Oct 21, 2020 at 20:53 | comment | added | combinatorist | Calling the child with the source command would work (to set variables in the parent), right? E.g. put source child.sh in your parent.sh. linuxize.com/post/bash-source-command It technically handles it in the scripts, not the environments, but I think it does what the OP wanted. | |
| Feb 23, 2019 at 15:36 | comment | added | Andry | Anwered here for both Linux and Windows: unix.stackexchange.com/questions/38205/… The idea is to pass into child script a temporary directory path, have save files into it and load back in a parent script using introduced help scripts. | |
| Jun 27, 2017 at 6:02 | comment | added | athena | You can't achieve a communication between two processes (whichever their relationship might be: parent → child or not) without a mechanism on both sides: one of them to talk and the other to listen. | |
| Jun 22, 2017 at 22:43 | vote | accept | Error | ||
| Jun 22, 2017 at 14:37 | history | edited | Error | CC BY-SA 3.0 | added 3 characters in body |
| Jun 22, 2017 at 14:05 | review | Reopen votes | |||
| Jun 22, 2017 at 14:52 | |||||
| Jun 22, 2017 at 13:54 | comment | added | Error | @Kusalananda edited | |
| Jun 22, 2017 at 13:53 | history | edited | Error | CC BY-SA 3.0 | added 65 characters in body |
| Jun 22, 2017 at 13:46 | history | edited | Error | CC BY-SA 3.0 | added 65 characters in body |
| Jun 22, 2017 at 11:53 | history | closed | muru Stephen Rauch Jeff Schaller♦ CommunityBot countermode | Duplicate of change environment of a running process | |
| Jun 22, 2017 at 9:47 | answer | added | G-Man Says 'Reinstate Monica' | timeline score: 5 | |
| Jun 22, 2017 at 8:18 | comment | added | Kusalananda♦ | Setting an environment variable in a parent process is not possible from a child. Try adding a description of what it is you want to achieve with this to the question. | |
| Jun 22, 2017 at 8:16 | history | edited | Kusalananda♦ | CC BY-SA 3.0 | Spelling and markup |
| Jun 22, 2017 at 5:57 | answer | added | athena | timeline score: 9 | |
| Jun 22, 2017 at 4:41 | review | Close votes | |||
| Jun 22, 2017 at 11:53 | |||||
| Jun 22, 2017 at 3:57 | history | edited | Error | CC BY-SA 3.0 | added 115 characters in body |
| Jun 22, 2017 at 3:56 | answer | added | heemayl | timeline score: 26 | |
| Jun 22, 2017 at 3:52 | history | asked | Error | CC BY-SA 3.0 |