help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shell aliases as shell-commands


From: Sebastian Tennant
Subject: Re: Shell aliases as shell-commands
Date: Wed, 21 Jan 2009 17:07:14 +0000
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Quoth Peter Dyballa <Peter_Dyballa@Web.DE>:
> Am 21.01.2009 um 16:26 schrieb Sebastian Tennant:
>
>>>   * In your emacs config (.emacs): (setenv "BASH_ENV" "~/.bashrc")
>>>     This tells emacs that non-interactive bash subprocesses should
>>>     load .bashrc.
>>
>> Damn that's a good tip.  Guess I should tell the folks over at
>> emacs.sources...
>
> Not that fast, Sebastian! The solution with BASH_ENV will introduce
> problems with non-interactive bash shell scripts!

I'm not sure what you mean by non-interactive [...] scripts?

`BASH_ENV'
     If this variable is set when Bash is invoked to execute a shell
     script, its value is expanded and used as the name of a startup
     file to read before executing the script.

If people set this variable, they can't complain if it then causes them
problems.  After all, it's simply doing what it's designed to do!

> The solution I suggested is valid only inside GNU Emacs; this is the
> proper way.

Forgive me, but I thought I'd explained why your solution wasn't exactly
a solution.

The variable shell-command-switch can only hold a single switch and we
need to call bash with two switches; -i _and_ -c if we want
shell-command to have access to aliases (and functions).  This is why I
went ahead and wrote interactive-shell-command (essentially a simpler
version of shell-command that calls shell-file-name (bash) with both
switches.

Sebastian






reply via email to

[Prev in Thread] Current Thread [Next in Thread]