Timeline for answer to Calling a function through command substitution by Andrei Borzenkov
Current License: CC BY-SA 4.0
Post Revisions
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 22 at 12:30 | comment | added | terdon♦ | @k314159 that's because a new invocation of bash is not a subshell. | |
| Jan 22 at 11:55 | comment | added | Andrei Borzenkov |
Subshell first executes new /bin/bash which throws away the inherited parent environment.
|
|
| Jan 22 at 11:49 | comment | added | k314159 |
Thanks. If I do this in a terminal: f() { echo Hi!; } bash -c f I get f: command not found so the subshell doesn't inherit functions from the parent.
|
|
| Jan 22 at 11:04 | history | answered | Andrei Borzenkov | CC BY-SA 4.0 |