* shell-command parameters
@ 2009-01-05 11:11 rustom
2009-01-05 13:35 ` Chetan
0 siblings, 1 reply; 12+ messages in thread
From: rustom @ 2009-01-05 11:11 UTC (permalink / raw
To: help-gnu-emacs
When I issue a shell command which is a pipeline such as say
echo 1 2 3; echo 4 5
in a normal shell I should get
1 2 3
4 5
However in windows for emacs shell-command (M-!) I get
1 2 3;echo 4 5
Any clues??
The worst part is it sometimes works and sometimes not!
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-command parameters
2009-01-05 11:11 shell-command parameters rustom
@ 2009-01-05 13:35 ` Chetan
2009-01-05 14:07 ` Peter Dyballa
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Chetan @ 2009-01-05 13:35 UTC (permalink / raw
To: help-gnu-emacs
rustom <rustompmody@gmail.com> writes:
> When I issue a shell command which is a pipeline such as say
>
> echo 1 2 3; echo 4 5
>
> in a normal shell I should get
> 1 2 3
> 4 5
>
> However in windows for emacs shell-command (M-!) I get
> 1 2 3;echo 4 5
>
> Any clues??
>
> The worst part is it sometimes works and sometimes not!
Do you mean you get different results on Windows or between Windows
and other systems?
If it is the latter, isn't that the expected behaviour?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-command parameters
2009-01-05 13:35 ` Chetan
@ 2009-01-05 14:07 ` Peter Dyballa
2009-01-05 20:15 ` Eli Zaretskii
[not found] ` <mailman.4046.1231186569.26697.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 12+ messages in thread
From: Peter Dyballa @ 2009-01-05 14:07 UTC (permalink / raw
To: Rustom Mody; +Cc: help-gnu-emacs
> rustom <rustompmody@gmail.com> writes:
>
>> When I issue a shell command which is a pipeline such as say
>>
>> echo 1 2 3; echo 4 5
This no pipeline, it's a sequence.
In a pipeline stdout of command a becomes stdin of command b.
--
Greetings
Pete
The problem with the French is that they don't have a word for «
entrepreneur ».
– George W. Bush
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-command parameters
2009-01-05 13:35 ` Chetan
2009-01-05 14:07 ` Peter Dyballa
@ 2009-01-05 20:15 ` Eli Zaretskii
[not found] ` <mailman.4046.1231186569.26697.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2009-01-05 20:15 UTC (permalink / raw
To: help-gnu-emacs
> From: Chetan <Chetan.xspam@xspam.sbcglobal.net>
> Date: Mon, 05 Jan 2009 05:35:45 -0800
>
> rustom <rustompmody@gmail.com> writes:
>
> > When I issue a shell command which is a pipeline such as say
> >
> > echo 1 2 3; echo 4 5
> >
> > in a normal shell I should get
> > 1 2 3
> > 4 5
> >
> > However in windows for emacs shell-command (M-!) I get
> > 1 2 3;echo 4 5
> >
> > Any clues??
> >
> > The worst part is it sometimes works and sometimes not!
>
> Do you mean you get different results on Windows or between Windows
> and other systems?
>
> If it is the latter, isn't that the expected behaviour?
Yes, it certainly is.
On Windows, if you want 2 commands on a single line, use `&' instead
of `;', as in
echo 1 2 3 & echo 4 5
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-command parameters
[not found] ` <mailman.4046.1231186569.26697.help-gnu-emacs@gnu.org>
@ 2009-01-05 21:40 ` Chetan
2009-01-06 4:05 ` Eli Zaretskii
[not found] ` <mailman.4079.1231214715.26697.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 12+ messages in thread
From: Chetan @ 2009-01-05 21:40 UTC (permalink / raw
To: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Chetan <Chetan.xspam@xspam.sbcglobal.net>
>> Date: Mon, 05 Jan 2009 05:35:45 -0800
>>
>> rustom <rustompmody@gmail.com> writes:
>>
>> > When I issue a shell command which is a pipeline such as say
>> >
>> > echo 1 2 3; echo 4 5
>> >
>> > in a normal shell I should get
>> > 1 2 3
>> > 4 5
>> >
>> > However in windows for emacs shell-command (M-!) I get
>> > 1 2 3;echo 4 5
>> >
>> > Any clues??
>> >
>> > The worst part is it sometimes works and sometimes not!
>>
>> Do you mean you get different results on Windows or between Windows
>> and other systems?
>>
>> If it is the latter, isn't that the expected behaviour?
>
> Yes, it certainly is.
>
> On Windows, if you want 2 commands on a single line, use `&' instead
> of `;', as in
>
> echo 1 2 3 & echo 4 5
Or
echo 1 2 3 && echo 4 5 and get the same result everywhere
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-command parameters
2009-01-05 21:40 ` Chetan
@ 2009-01-06 4:05 ` Eli Zaretskii
[not found] ` <mailman.4079.1231214715.26697.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2009-01-06 4:05 UTC (permalink / raw
To: help-gnu-emacs
> From: Chetan <Chetan.xspam@xspam.sbcglobal.net>
> Date: Mon, 05 Jan 2009 13:40:27 -0800
>
> > On Windows, if you want 2 commands on a single line, use `&' instead
> > of `;', as in
> >
> > echo 1 2 3 & echo 4 5
> Or
> echo 1 2 3 && echo 4 5 and get the same result everywhere
The semantics of ;/& and && is not the same. With `echo', the
difference hardly matters, but in general, the former will always run
both commands, while the latter will sometimes only run the first one.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-command parameters
[not found] ` <mailman.4079.1231214715.26697.help-gnu-emacs@gnu.org>
@ 2009-01-06 7:33 ` rustom
2009-01-06 14:29 ` Kevin Rodgers
[not found] ` <mailman.4120.1231252170.26697.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 12+ messages in thread
From: rustom @ 2009-01-06 7:33 UTC (permalink / raw
To: help-gnu-emacs
On Jan 6, 9:05 am, Eli Zaretskii <e...@gnu.org> wrote:
> > From: Chetan <Chetan.xs...@xspam.sbcglobal.net>
> > Date: Mon, 05 Jan 2009 13:40:27 -0800
>
> > > On Windows, if you want 2 commands on a single line, use `&' instead
> > > of `;', as in
>
> > > echo 1 2 3 & echo 4 5
> > Or
> > echo 1 2 3 && echo 4 5 and get the same result everywhere
>
> The semantics of ;/& and && is not the same. With `echo', the
> difference hardly matters, but in general, the former will always run
> both commands, while the latter will sometimes only run the first one.
Thanks.
I guess mostly one needs cmd1 && cmd2. And the unix equivalent of
cmd1 ; cmd2 is cmd1 & cmd2.
But I still wonder what shell is running in windows emacs?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-command parameters
2009-01-06 7:33 ` rustom
@ 2009-01-06 14:29 ` Kevin Rodgers
[not found] ` <mailman.4120.1231252170.26697.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 12+ messages in thread
From: Kevin Rodgers @ 2009-01-06 14:29 UTC (permalink / raw
To: help-gnu-emacs
rustom wrote:
> On Jan 6, 9:05 am, Eli Zaretskii <e...@gnu.org> wrote:
>>> From: Chetan <Chetan.xs...@xspam.sbcglobal.net>
>>> Date: Mon, 05 Jan 2009 13:40:27 -0800
>>>> On Windows, if you want 2 commands on a single line, use `&' instead
>>>> of `;', as in
>>>> echo 1 2 3 & echo 4 5
>>> Or
>>> echo 1 2 3 && echo 4 5 and get the same result everywhere
>> The semantics of ;/& and && is not the same. With `echo', the
>> difference hardly matters, but in general, the former will always run
>> both commands, while the latter will sometimes only run the first one.
>
> Thanks.
>
> I guess mostly one needs cmd1 && cmd2. And the unix equivalent of
> cmd1 ; cmd2 is cmd1 & cmd2.
>
> But I still wonder what shell is running in windows emacs?
,----[ C-h v shell-file-name RET ]
| shell-file-name is a variable defined in `src/callproc.c'.
| Its value is "/bin/bash"
|
|
| Documentation:
| *File name to load inferior shells from.
| Initialized from the SHELL environment variable, or to a system-dependent
| default if SHELL is not set.
|
| You can customize this variable.
|
| [back]
`----
Looking at callproc.c, the system-dependent default is "/bin/sh".
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-command parameters
[not found] ` <mailman.4120.1231252170.26697.help-gnu-emacs@gnu.org>
@ 2009-01-06 15:02 ` rustom
2009-01-06 15:45 ` Andreas Politz
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: rustom @ 2009-01-06 15:02 UTC (permalink / raw
To: help-gnu-emacs
On Jan 6, 7:29 pm, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> rustom wrote:
> > But I still wonder what shell is running in windows emacs?
>
> ,----[ C-h v shell-file-name RET ]
> | shell-file-name is a variable defined in `src/callproc.c'.
> | Its value is "/bin/bash"
Thanks. Thats the variable I was looking for.
It turns out to be /path/to/emacs/bin/cmdproxy.exe
Changing it to c:/cygwin/bin/bash.exe makes it work as expected (by a
unix user)
I wonder does emacs go out of its way to make life difficult for a
windows user? MS does a good job of this without help from emacs :-)
I mean 'cmd' has one expected behavior; shell has another. Why make
the 'shell' variable point to a cmd imitation?
(Sorry to grumble)
Is it possible to remember the calls to these shell calls (made with
M-!) across emacs invocations -- the way bash remembers?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-command parameters
2009-01-06 15:02 ` rustom
@ 2009-01-06 15:45 ` Andreas Politz
2009-01-06 20:40 ` Eli Zaretskii
2009-01-08 5:50 ` Barry Margolin
2 siblings, 0 replies; 12+ messages in thread
From: Andreas Politz @ 2009-01-06 15:45 UTC (permalink / raw
To: help-gnu-emacs
rustom wrote:
> On Jan 6, 7:29 pm, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
>> rustom wrote:
>>> But I still wonder what shell is running in windows emacs?
>> ,----[ C-h v shell-file-name RET ]
>> | shell-file-name is a variable defined in `src/callproc.c'.
>> | Its value is "/bin/bash"
>
>
> Thanks. Thats the variable I was looking for.
> It turns out to be /path/to/emacs/bin/cmdproxy.exe
> Changing it to c:/cygwin/bin/bash.exe makes it work as expected (by a
> unix user)
>
> I wonder does emacs go out of its way to make life difficult for a
> windows user? MS does a good job of this without help from emacs :-)
> I mean 'cmd' has one expected behavior; shell has another. Why make
> the 'shell' variable point to a cmd imitation?
>
> (Sorry to grumble)
>
> Is it possible to remember the calls to these shell calls (made with
> M-!) across emacs invocations -- the way bash remembers?
savehist-mode
?
-ap
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-command parameters
2009-01-06 15:02 ` rustom
2009-01-06 15:45 ` Andreas Politz
@ 2009-01-06 20:40 ` Eli Zaretskii
2009-01-08 5:50 ` Barry Margolin
2 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2009-01-06 20:40 UTC (permalink / raw
To: help-gnu-emacs
> From: rustom <rustompmody@gmail.com>
> Date: Tue, 6 Jan 2009 07:02:14 -0800 (PST)
>
> On Jan 6, 7:29 pm, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> > rustom wrote:
> > > But I still wonder what shell is running in windows emacs?
> >
> > ,----[ C-h v shell-file-name RET ]
> > | shell-file-name is a variable defined in `src/callproc.c'.
> > | Its value is "/bin/bash"
>
>
> Thanks. Thats the variable I was looking for.
> It turns out to be /path/to/emacs/bin/cmdproxy.exe
> Changing it to c:/cygwin/bin/bash.exe makes it work as expected (by a
> unix user)
>
> I wonder does emacs go out of its way to make life difficult for a
> windows user? MS does a good job of this without help from emacs :-)
> I mean 'cmd' has one expected behavior; shell has another. Why make
> the 'shell' variable point to a cmd imitation?
cmdproxy is not an imitation of CMD, it's a _proxy_ which eventually
invokes the real CMD.EXE. Thus its name.
As to the reasons why this is needed, here's the relevant commentary
from cmdproxy.c:
Accepts subset of Unix sh(1) command-line options, for compatibility
with elisp code written for Unix. When possible, executes external
programs directly (a common use of /bin/sh by Emacs), otherwise
invokes the user-specified command processor to handle built-in shell
commands, batch files and interactive mode.
The main function is simply to process the "-c string" option in the
way /bin/sh does, since the standard Windows command shells use the
convention that everything after "/c" (the Windows equivalent of
"-c") is the input string.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-command parameters
2009-01-06 15:02 ` rustom
2009-01-06 15:45 ` Andreas Politz
2009-01-06 20:40 ` Eli Zaretskii
@ 2009-01-08 5:50 ` Barry Margolin
2 siblings, 0 replies; 12+ messages in thread
From: Barry Margolin @ 2009-01-08 5:50 UTC (permalink / raw
To: help-gnu-emacs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1252 bytes --]
In article
<dd6000ea-5ab7-411c-966d-a715f68c94c9@d42g2000prb.googlegroups.com>,
rustom <rustompmody@gmail.com> wrote:
> On Jan 6, 7:29 pm, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> > rustom wrote:
> > > But I still wonder what shell is running in windows emacs?
> >
> > ,----[ C-h v shell-file-name RET ]
> > | shell-file-name is a variable defined in `src/callproc.c'.
> > | Its value is "/bin/bash"
>
>
> Thanks. Thats the variable I was looking for.
> It turns out to be /path/to/emacs/bin/cmdproxy.exe
> Changing it to c:/cygwin/bin/bash.exe makes it work as expected (by a
> unix user)
>
> I wonder does emacs go out of its way to make life difficult for a
> windows user? MS does a good job of this without help from emacs :-)
> I mean 'cmd' has one expected behavior; shell has another. Why make
> the 'shell' variable point to a cmd imitation?
I think the expectation is that shell-command should behave similarly to
typing the command in the system's normal command line interface. Why
would a Windows user expect Unix-like behavior?
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-01-08 5:50 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-05 11:11 shell-command parameters rustom
2009-01-05 13:35 ` Chetan
2009-01-05 14:07 ` Peter Dyballa
2009-01-05 20:15 ` Eli Zaretskii
[not found] ` <mailman.4046.1231186569.26697.help-gnu-emacs@gnu.org>
2009-01-05 21:40 ` Chetan
2009-01-06 4:05 ` Eli Zaretskii
[not found] ` <mailman.4079.1231214715.26697.help-gnu-emacs@gnu.org>
2009-01-06 7:33 ` rustom
2009-01-06 14:29 ` Kevin Rodgers
[not found] ` <mailman.4120.1231252170.26697.help-gnu-emacs@gnu.org>
2009-01-06 15:02 ` rustom
2009-01-06 15:45 ` Andreas Politz
2009-01-06 20:40 ` Eli Zaretskii
2009-01-08 5:50 ` Barry Margolin
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.