Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh functions not playing nice.



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



Messages sorted by: Reverse Date, Date, Thread, Author