* Jorgen Grahn, 2017-08-14 09:11 UTC:
> On Mon, 2017-08-14, Ian Zimmerman wrote:
>> On 2017-08-13 11:28, Michael Uplawski wrote:
[fwiw, I didnt receive the OP, so I don't know if there was additional context]
>>> The aliases that I have defined in .bashrc are not available in the
>>> Mutt shell, after hitting '!'.
>>
>> Since you mention .bashrc, I assume your /bin/sh is bash (you're not
>> running debian or ubuntu for example, both of which use dash).
>
> I use zsh myself on Debian, but I'm pretty sure it's common for users
> to have bash as their default shell. dash(1) sounds more like a popular
> choice for /bin/sh.
>
> As for the OP's problem: ~/.bashrc is run by every /interactive/
> shell. Do we know that Mutt's ! command starts an interactive shell?
There are two cases:
1) entering a command (executable name and arguments) after mutt's
"Shell command:" prompt
* the executable is executed (via execle("/bin/sh","sh","-c",...)),
no interactive shell is started, hence aliases defined in ~/.bashrc
are not available, even if /bin/sh would point to bash (and then it
still would not behave as bash but mimic sh instead)
2) leaving the input field empty and hitting enter
* an interactive shell is started, if the SHELL env var is defined
then that is used as shell command, otherwise /bin/sh as
a fallback, and executed as in #1
* this should source ~/.bashrc if SHELL=/bin/bash (or whatever
applicable on that system)
* the shell has to be terminated with exit to return to mutt
> If it doesn't, it may be hard to find a good place to activate
> aliases, You don't want to burden every short-lived shell process in
> scripts and pipelines with a lot of startup overhead ... and bash
> doesn't even seem to support it.
Bash non-interactive looks for $BASH_ENV to source, but I doubt that's
also the case when invoked as sh, ie. if /bin/sh points to bash. If it
does then it would be possible to set BASH_ENV in the shell from which
mutt is started, though it wouldn't be a good idea to have
non-interactive shells source ~/.bashrc and/or arbitrary alias
definitions and what not..
Eike
--
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Care about Free Software, support the FSFE
https://fsfe.org/support/?erack
Use LibreOffice!
https://www.libreoffice.org/