zsh-users
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: zsh-users@zsh.org
Subject: Re: zsh functions not playing nice.
Date: Sat, 19 Jan 2013 17:38:07 +0000	[thread overview]
Message-ID: <20130119173807.GB7039@chaz.gmail.com> (raw)
In-Reply-To: <50FAD0AF.60506@eastlink.ca>

2013-01-19 08:58:23 -0800, Ray Andrews:
> Gentlemen,
> 
> I can't get this sort of thing to work:
> 
>     $ nice -n 20 some-zsh-function
> 
> returns:
> 
>    "nice: some-zsh-function: No such file or directory.
> 
> I can use 'nice' with any builtin or binary or script, just not with
> a function.
> How do I solve that?
[...]

~$ type nice
nice is /usr/bin/nice

There's no way it can know about a zsh function which is
something internal to the shell.

It *executes* a command. So what you think is a builtin is
the command version of it in /bin or /usr/bin:

~$ strace -fe execve nice echo test
execve("/bin/echo", ["echo", "test"], [/* 40 vars */]) = 0

What you could do is:

some-zsh-function & renice $!; fg

Note that it would run that function in a subshell.

-- 
Stephane


  reply	other threads:[~2013-01-19 18:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-19 16:58 Ray Andrews
2013-01-19 17:38 ` Stephane Chazelas [this message]
2013-01-19 18:53   ` Ray Andrews
2013-01-19 17:51 ` Russell Harmon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130119173807.GB7039@chaz.gmail.com \
    --to=stephane.chazelas@gmail.com \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).