unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* eshell aliases and extra parameters
@ 2019-06-18 19:59 jonetsu
  2019-06-19  5:26 ` Colin Baxter
  0 siblings, 1 reply; 3+ messages in thread
From: jonetsu @ 2019-06-18 19:59 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I have defined an alias for eshell, which is found
in .emacs/eshell/alias :

alias PC17 g++ -Wall -std=c++17 -pthread $1

This works fine to compile files, such as:

PC17 explicit.cc

Although it does not work when an extra compile parameter is added,
such as:

PC17 -DEXPLICIT explicit.cc 
g++: fatal error: no input files

It looks like $1 does not stand for any number of arguments, taking one
and rejecting any others.

At the regular Linux console, the just-about same (w/o the $1) alias
works with extra params:

alias PC17='g++ -Wall -std=c++17 -pthread

% PC17 -DEXPLICIT explicit.cc

Is there a way to add on-the-spot parameters in eshell w/o having to
modify the eshell alias itself ?

Cheers.



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

* Re: eshell aliases and extra parameters
  2019-06-18 19:59 eshell aliases and extra parameters jonetsu
@ 2019-06-19  5:26 ` Colin Baxter
  2019-06-19 13:28   ` jonetsu
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Baxter @ 2019-06-19  5:26 UTC (permalink / raw)
  To: jonetsu; +Cc: help-gnu-emacs

Dear Jonetsu,
>>>>> jonetsu  <jonetsu@teksavvy.com> writes:

    > Hello, I have defined an alias for eshell, which is found in
    > .emacs/eshell/alias :

    > alias PC17 g++ -Wall -std=c++17 -pthread $1

    > This works fine to compile files, such as:

    > PC17 explicit.cc

    > Although it does not work when an extra compile parameter is
    > added, such as:

    > PC17 -DEXPLICIT explicit.cc g++: fatal error: no input files

    > It looks like $1 does not stand for any number of arguments,
    > taking one and rejecting any others.

    > At the regular Linux console, the just-about same (w/o the $1)
    > alias works with extra params:

    > alias PC17='g++ -Wall -std=c++17 -pthread

    > % PC17 -DEXPLICIT explicit.cc

    > Is there a way to add on-the-spot parameters in eshell w/o having
    > to modify the eshell alias itself ?

Try $* rather than $1, as in

alias PC17 g++ -Wall -std=c++17 -pthread $*

Best wishes,

Colin Baxter.



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

* Re: eshell aliases and extra parameters
  2019-06-19  5:26 ` Colin Baxter
@ 2019-06-19 13:28   ` jonetsu
  0 siblings, 0 replies; 3+ messages in thread
From: jonetsu @ 2019-06-19 13:28 UTC (permalink / raw)
  To: Colin Baxter; +Cc: help-gnu-emacs

On Wed, 19 Jun 2019 06:26:09 +0100
Colin Baxter <m43cap@yandex.com> wrote:

Hello,

> Try $* rather than $1, as in
> alias PC17 g++ -Wall -std=c++17 -pthread $*

Thanks.  This works very well.

Cheers.



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

end of thread, other threads:[~2019-06-19 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-18 19:59 eshell aliases and extra parameters jonetsu
2019-06-19  5:26 ` Colin Baxter
2019-06-19 13:28   ` jonetsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).