all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* eshell command substitution?
@ 2023-12-23 15:39 Jeff Clough
  2023-12-23 15:58 ` Stephen Berman
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Clough @ 2023-12-23 15:39 UTC (permalink / raw)
  To: emacs-help

Good Morning!

Does eshell have command substitution? If so, can someone point me to
its syntax. My search-fu is failing me.

My usual use case...

$ g++ base.cpp -o base `pkg-config gtkmm-3.0 --cflags --libs`

Backticks don't work, nor does $(...) unsurprisingly.

I've gotta be missing something glaringly obvious here, but I can't find
an answer.

Jeff




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: eshell command substitution?
  2023-12-23 15:39 eshell command substitution? Jeff Clough
@ 2023-12-23 15:58 ` Stephen Berman
  2023-12-23 16:12   ` Jeff Clough
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Berman @ 2023-12-23 15:58 UTC (permalink / raw)
  To: Jeff Clough; +Cc: emacs-help

On Sat, 23 Dec 2023 10:39:49 -0500 Jeff Clough <jeff@jeffclough.net> wrote:

> Good Morning!
>
> Does eshell have command substitution? If so, can someone point me to
> its syntax. My search-fu is failing me.
>
> My usual use case...
>
> $ g++ base.cpp -o base `pkg-config gtkmm-3.0 --cflags --libs`
>
> Backticks don't work, nor does $(...) unsurprisingly.
>
> I've gotta be missing something glaringly obvious here, but I can't find
> an answer.

This should work (see (info "(eshell) Dollars Expansion")):

$ g++ base.cpp -o base ${pkg-config gtkmm-3.0 --cflags --libs}

Steve Berman



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: eshell command substitution?
  2023-12-23 15:58 ` Stephen Berman
@ 2023-12-23 16:12   ` Jeff Clough
  2023-12-23 16:29     ` Stephen Berman
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jeff Clough @ 2023-12-23 16:12 UTC (permalink / raw)
  To: Stephen Berman; +Cc: emacs-help

Stephen Berman <stephen.berman@gmx.net> writes:

> This should work (see (info "(eshell) Dollars Expansion")):
>
> $ g++ base.cpp -o base ${pkg-config gtkmm-3.0 --cflags --libs}
>
> Steve Berman

Progress! Running that command, I get the proper output from pkg-config,
but it's wrapped in single quotes, which the compiler doesn't like.

Playing with the options on the page you linked doesn't seem to help.

Jeff



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: eshell command substitution?
  2023-12-23 16:12   ` Jeff Clough
@ 2023-12-23 16:29     ` Stephen Berman
  2023-12-23 16:34       ` Jeff Clough
  2023-12-23 16:30     ` Jeff Clough
  2023-12-31  2:19     ` Steven Allen
  2 siblings, 1 reply; 8+ messages in thread
From: Stephen Berman @ 2023-12-23 16:29 UTC (permalink / raw)
  To: Jeff Clough; +Cc: emacs-help

On Sat, 23 Dec 2023 11:12:22 -0500 Jeff Clough <jeff@jeffclough.net> wrote:

> Stephen Berman <stephen.berman@gmx.net> writes:
>
>> This should work (see (info "(eshell) Dollars Expansion")):
>>
>> $ g++ base.cpp -o base ${pkg-config gtkmm-3.0 --cflags --libs}
>>
>> Steve Berman
>
> Progress! Running that command, I get the proper output from pkg-config,
> but it's wrapped in single quotes, which the compiler doesn't like.

Hm, it works for me, i.e. the file (I took a random file of C++ source
code) was compiled and an object file produced.  Also, when I run `print
${pkg-config gtkmm-3.0 --cflags --libs}' in Eshell the output is not
wrapped in any quotes.  This is with both emacs-29 and emacs-30.  Are
you using a different version?

Steve Berman





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: eshell command substitution?
  2023-12-23 16:12   ` Jeff Clough
  2023-12-23 16:29     ` Stephen Berman
@ 2023-12-23 16:30     ` Jeff Clough
  2023-12-23 16:46       ` Stephen Berman
  2023-12-31  2:19     ` Steven Allen
  2 siblings, 1 reply; 8+ messages in thread
From: Jeff Clough @ 2023-12-23 16:30 UTC (permalink / raw)
  To: Stephen Berman; +Cc: emacs-help

Jeff Clough <jeff@jeffclough.net> writes:

> Stephen Berman <stephen.berman@gmx.net> writes:
>
>> This should work (see (info "(eshell) Dollars Expansion")):
>>
>> $ g++ base.cpp -o base ${pkg-config gtkmm-3.0 --cflags --libs}
>>
>> Steve Berman
>
> Progress! Running that command, I get the proper output from pkg-config,
> but it's wrapped in single quotes, which the compiler doesn't like.

Wait, no. No, it's not. It's outputting exactly as it should.

If I do this in gnome-terminal, it works...

$ g++ -g -o base base.cpp `pkg-config gtkmm-3.0 --cflags --libs}`

I can run the call to pkg-config by itself, and I get the endless line
of options I expect.

If I run this in eshell, it doesn't work...

$ g++ -g -o base base.cpp ${pkg-config gtkmm-3.0 --cflags --libs}

I get "g++: error: unrecognized command-line option '...'"

With the enless line of options in quotes, but that's just the compiler
quoting at me.

If I do...

${pkg-config gtkmm-3.0 --cflags --libs}

In eshell, I get the same result as if I ran pkg-config in
gnome-terminal.

I'm even more confused.

Jeff



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: eshell command substitution?
  2023-12-23 16:29     ` Stephen Berman
@ 2023-12-23 16:34       ` Jeff Clough
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Clough @ 2023-12-23 16:34 UTC (permalink / raw)
  To: Stephen Berman; +Cc: emacs-help

Stephen Berman <stephen.berman@gmx.net> writes:

> Hm, it works for me, i.e. the file (I took a random file of C++ source
> code) was compiled and an object file produced.  Also, when I run `print
> ${pkg-config gtkmm-3.0 --cflags --libs}' in Eshell the output is not
> wrapped in any quotes.  This is with both emacs-29 and emacs-30.  Are
> you using a different version?

Sorry, the quote thing was a red herring. It's been a long day.

I'm running emacs-29 built from the repo. emacs-version is...

GNU Emacs 29.1.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33,
cairo version 1.16.0) of 2023-12-02

I'm sure I'm neglecting something dead simple, but I've only started
using eshell about five days ago.

Jeff



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: eshell command substitution?
  2023-12-23 16:30     ` Jeff Clough
@ 2023-12-23 16:46       ` Stephen Berman
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Berman @ 2023-12-23 16:46 UTC (permalink / raw)
  To: Jeff Clough; +Cc: emacs-help

On Sat, 23 Dec 2023 11:30:05 -0500 Jeff Clough <jeff@jeffclough.net> wrote:

> Jeff Clough <jeff@jeffclough.net> writes:
>
>> Stephen Berman <stephen.berman@gmx.net> writes:
>>
>>> This should work (see (info "(eshell) Dollars Expansion")):
>>>
>>> $ g++ base.cpp -o base ${pkg-config gtkmm-3.0 --cflags --libs}
>>>
>>> Steve Berman
>>
>> Progress! Running that command, I get the proper output from pkg-config,
>> but it's wrapped in single quotes, which the compiler doesn't like.
>
> Wait, no. No, it's not. It's outputting exactly as it should.
>
> If I do this in gnome-terminal, it works...
>
> $ g++ -g -o base base.cpp `pkg-config gtkmm-3.0 --cflags --libs}`
>
> I can run the call to pkg-config by itself, and I get the endless line
> of options I expect.
>
> If I run this in eshell, it doesn't work...
>
> $ g++ -g -o base base.cpp ${pkg-config gtkmm-3.0 --cflags --libs}
>
> I get "g++: error: unrecognized command-line option '...'"
>
> With the enless line of options in quotes, but that's just the compiler
> quoting at me.

I get that with when the pkg-config command is wrapped in backticks, but
with ${} the compilation succeeds for me.

> If I do...
>
> ${pkg-config gtkmm-3.0 --cflags --libs}
>
> In eshell, I get the same result as if I ran pkg-config in
> gnome-terminal.
>
> I'm even more confused.

Strange.

Steve Berman



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: eshell command substitution?
  2023-12-23 16:12   ` Jeff Clough
  2023-12-23 16:29     ` Stephen Berman
  2023-12-23 16:30     ` Jeff Clough
@ 2023-12-31  2:19     ` Steven Allen
  2 siblings, 0 replies; 8+ messages in thread
From: Steven Allen @ 2023-12-31  2:19 UTC (permalink / raw)
  To: Jeff Clough, Stephen Berman; +Cc: emacs-help


Jeff Clough <jeff@jeffclough.net> writes:
> Progress! Running that command, I get the proper output from pkg-config,
> but it's wrapped in single quotes, which the compiler doesn't like.
>
> Playing with the options on the page you linked doesn't seem to help.

The issue is that eshell splits on lines [1], not words. A workaround is to
append `(:S)` [2]:

$ g++ base.cpp -o base ${pkg-config gtkmm-3.0 --cflags --libs}(:S)

[1]: https://www.gnu.org/software/emacs/manual/html_node/eshell/Dollars-Expansion.html
[2]: https://www.gnu.org/software/emacs/manual/html_node/eshell/Argument-Modifiers.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-31  2:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-23 15:39 eshell command substitution? Jeff Clough
2023-12-23 15:58 ` Stephen Berman
2023-12-23 16:12   ` Jeff Clough
2023-12-23 16:29     ` Stephen Berman
2023-12-23 16:34       ` Jeff Clough
2023-12-23 16:30     ` Jeff Clough
2023-12-23 16:46       ` Stephen Berman
2023-12-31  2:19     ` Steven Allen

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.