Closed sinewalker closed 6 years ago
according to the GNU manual, the output of kill -l
differs for POSIX
SIG
" in the signal namesSo this will test for the presence of POSIX mode and works in both bash and sh:
kill -l|grep SIG > /dev/null || echo sh
here is an error from LightTable:
Error: Error: Command failed: /bin/sh -c PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH && source /Users/mjl/.bash_profile && echo $PATH
/Users/mjl/.dotfiles/source/30_file.sh: line 123: `du-no-traverse': not a valid identifier
is not ISeqable
at Error (native)
at cljs.core.seq (file:///Applications/LightTable.app/Contents/Resources/app/core/node_modules/lighttable/bootstrap.js:2833:11)
at cljs.core.empty_QMARK_ (file:///Applications/LightTable.app/Contents/Resources/app/core/node_modules/lighttable/bootstrap.js:3693:62)
at file:///Applications/LightTable.app/Contents/Resources/app/core/node_modules/lighttable/bootstrap.js:31504:32
at ChildProcess.exithandler (child_process.js:222:5)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:817:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
So I should put this test into .bash_profile I think
Commit 49957b1 fixes
e.g. LightTable tries to run /bin/sh when starts a subshell. So Bash honours POSIX and fails on 30_file.sh where a function is defined with '-' in its name.
I think for sub-shells I probably don't want all the interactive dotfile guff anyway. So I should probably try and detect if bash is running as /bin/sh or POSIX and skip sourcing all the stuff.