bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "jobs" doesn't consistently expand function arguments


From: Chet Ramey
Subject: Re: "jobs" doesn't consistently expand function arguments
Date: Tue, 24 Jul 2018 14:12:26 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 7/23/18 7:54 PM, Keith Thompson wrote:

> Bash Version: 4.4
> Patch Level: 19
> Release Status: release
> 
> Description:
>         The "jobs" command doesn't consistently expand function arguments
> 
> Repeat-By:
>         For example:
> 
>         /bin/bash --login --noprofile
>         bash-4.4$ nap() { sleep "$@" ; }
>         bash-4.4$ nap 1234
>         ^Z
>         [1]+  Stopped                 sleep "$@"
>         bash-4.4$ bg
>         [1]+ sleep "$@" &
>         bash-4.4$ nap 2345 &
>         [2] 9666
>         bash-4.4$ jobs
>         [1]-  Running                 sleep "$@" &
>         [2]+  Running                 nap 2345 &
>         bash-4.4$
> 
> The problem is the '"$@"' in the "jobs" output, which doesn't provide
> any useful information.

This is how bash has behaved from its earliest days. The string associated
with the child process (the object that can be suspended) is the command
string before expansion.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]