Skip to main content
10 events
when toggle format what by license comment
Jun 14, 2019 at 16:47 comment added terdon @profPlum your [ if $SHELL ] won't help. The $SHELL variable just has your default login shell, it doesn't have any relation to the shell you are currently running. Actually, this would be much easier to sort out if we could have a quick chat so you can show the relevant files. If you have the time, please give me a ping (@terdon) here: chat.stackexchange.com/rooms/94923/…
Jun 14, 2019 at 16:29 comment added profPlum @terdon: they are indeed being exported, I didn't include the export -f log because it wasn't part of the log() source code technically... @Bodo: also in essence I believe you are correct
Jun 14, 2019 at 16:21 comment added profPlum @terdon: I'm sorry I forgot to mention I already tried something like this. specifically I tried: if [ $SHELL='sh' ]; then exit 0; fi inside my .bash_aliases script. It didn't work and I assumed this was because sh was directly importing the files from my environment.
Jun 14, 2019 at 16:07 comment added terdon @Bodo yeah, I am sort of assuming that the functions aren't actually exported since the question doesn't show any export -f. I took that to be a misunderstanding of the OP's. The rest I got because we know the OP is running a login shell and yet stuff defined in bashrc is being called and from this comment.
Jun 14, 2019 at 16:06 comment added Bodo The OP wrote explicitly about "exported functions". I may have overlooked it, but where did you find the information that .profile sources .bashrc?
Jun 14, 2019 at 16:05 comment added terdon @Bodo see updated answer, I explained it a bit more.
Jun 14, 2019 at 16:05 history edited terdon CC BY-SA 4.0
added 805 characters in body
Jun 14, 2019 at 16:01 comment added terdon @Bodo I don't see the relevance. sh is sourcing .bash_aliases because the OP is logging into a remote machine, so starting a login shell. Login shells read .profile and the OP's .profile is set to source .bashrc which, in turn, sources .bash_aliases :)
Jun 14, 2019 at 15:58 comment added Bodo Probably /bin/sh does not source .bash_aliases, but the exported function is passed to sh, see unix.stackexchange.com/q/157547/330217
Jun 14, 2019 at 15:55 history answered terdon CC BY-SA 4.0