Hacker News new | ask | show | jobs
by zbentley 21 days ago
Presumably you can call chdir(2) from the C code?

Or did you mean change the directory of the calling shell (in which case, executable shell scripts written in Bash and friends can’t do that either).

1 comments

Well, you can "source" a script, so its effects persist in your current shell session. That's a feature of the script and your shell sharing the same language.
Sure, but “shell scripts” as an (admittedly imprecise) term usually imply separate executable files, not shell libraries/functions that are sourced.
Then it seems that what you want is running a repl of your chosen language rather than shell/"executable" scripts.