Single visible post; 1 more post hidden or not public
jump to replies#TIL (+): You can use env -C foo to run commands in a different workdir. Basically like git -C foo, but for every command; or a shorter pushd foo && command && popd, if you wish
#TIL (-): It's not a part of POSIX (not even 1-2024), so you can't rely on it being everywhere T_T GNU and BSDs seem to have it, though
1 visible reply; 1 more reply hidden or not public
back to top@kytta hey, to battle your (-): unlike `env`, POSIX does specify subshells ( https://pubs.opengroup.org/onlinepubs/9699919799.2016edition/utilities/V3_chap02.html#tag_18_09_04_01 ), so `( cd /foo && command )` is perfectly fine, and frankly, at least as intention-clarifying as `env -C foo command`.
Another one for your #TIL (-): You can't use `#!/usr/bin/env -C foo command` as a shebang line, as most OSes only support 1 parameter to the executable, sadly.