zsh-users
 help / color / mirror / code / Atom feed
* alias -- do not pass args
@ 2006-09-11 18:50 Roman Cheplyaka
  2006-09-11 19:02 ` Frank Terbeck
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Roman Cheplyaka @ 2006-09-11 18:50 UTC (permalink / raw)
  To: zsh-users

I want to define alias which would /not/ pass its args to program.
E.g.
$ alias foo='echo lol'
$ foo a b
should just print lol, not "lol a b". How can I do this?

I haven't found this in the manual.
-- 
Roman I. Cheplyaka


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

* Re: alias -- do not pass args
  2006-09-11 18:50 alias -- do not pass args Roman Cheplyaka
@ 2006-09-11 19:02 ` Frank Terbeck
  2006-09-11 19:02 ` Tobias Gruetzmacher
  2006-09-11 19:11 ` Jean-Rene David
  2 siblings, 0 replies; 4+ messages in thread
From: Frank Terbeck @ 2006-09-11 19:02 UTC (permalink / raw)
  To: zsh-users

Roman Cheplyaka <roman.cheplyaka@gmail.com>:
> I want to define alias which would /not/ pass its args to program.
> E.g.
> $ alias foo='echo lol'
> $ foo a b
> should just print lol, not "lol a b". How can I do this?

Use a function for that:

[snip]
zsh% function foo() { echo bar } ; foo Hello World.
bar
[snap]

Regards, Frank


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

* Re: alias -- do not pass args
  2006-09-11 18:50 alias -- do not pass args Roman Cheplyaka
  2006-09-11 19:02 ` Frank Terbeck
@ 2006-09-11 19:02 ` Tobias Gruetzmacher
  2006-09-11 19:11 ` Jean-Rene David
  2 siblings, 0 replies; 4+ messages in thread
From: Tobias Gruetzmacher @ 2006-09-11 19:02 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 647 bytes --]

Hi,

On Mon, Sep 11, 2006 at 09:50:45PM +0300, Roman Cheplyaka wrote:
> I want to define alias which would /not/ pass its args to program.
> E.g.
> $ alias foo='echo lol'
> $ foo a b
> should just print lol, not "lol a b". How can I do this?

Maybe end the alias with a command that swallows its arguments?

Like
 alias foo='echo lol; true'
or even
 alias foo='echo lol && true'
to get the correct exit status.

Greetings, Tobi

-- 
GPG-Key 0xE2BEA341 - signed/encrypted mail preferred
My, oh so small, homepage: http://portfolio16.de/
http://www.fli4l.de/ - ISDN- & DSL-Router on one disk!
Registered FLI4L-User #00000003

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: alias -- do not pass args
  2006-09-11 18:50 alias -- do not pass args Roman Cheplyaka
  2006-09-11 19:02 ` Frank Terbeck
  2006-09-11 19:02 ` Tobias Gruetzmacher
@ 2006-09-11 19:11 ` Jean-Rene David
  2 siblings, 0 replies; 4+ messages in thread
From: Jean-Rene David @ 2006-09-11 19:11 UTC (permalink / raw)
  To: zsh-users

* Roman Cheplyaka [2006.09.11 15:00]:
> I want to define alias which would /not/ pass its args to program.
> E.g.
> $ alias foo='echo lol'
> $ foo a b
> should just print lol, not "lol a b". How can I do this?

Well in this case the alias does not pass its args
to the program. The alias is just expanded and the
whole line is passed to 'echo' by the shell.

You could obtain what you want with a shell
function:

% foo() { echo lol; }
% foo a b
lol
% 

It doesn't make much sense to do it with an alias
anyway. Unless I'm missing something...

-- 
JR


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

end of thread, other threads:[~2006-09-11 19:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-11 18:50 alias -- do not pass args Roman Cheplyaka
2006-09-11 19:02 ` Frank Terbeck
2006-09-11 19:02 ` Tobias Gruetzmacher
2006-09-11 19:11 ` Jean-Rene David

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).