bug-bash
[Top][All Lists]
Advanced

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

Re: Issus with popd and pushd


From: Chet Ramey
Subject: Re: Issus with popd and pushd
Date: Tue, 18 Apr 2017 14:17:19 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 4/18/17 2:13 PM, L A Walsh wrote:
> Chet Ramey wrote:
>> On 4/18/17 9:35 AM, Eduardo Bustamante wrote:
>>
>>  
>>> Or now that I think about it, you can get away with these functions:
>>>
>>> # masked builtins
>>> address@hidden:~/foo/bar/baz$ pushd() { builtin pushd "$@" >/dev/null;
>>> dirs -v; }; popd(){ builtin popd "$@" >/dev/null; dirs -v; }
>>>     
>>
>> This would be the preferable alternative, since it's so trivial.  The one
>> change I would suggest would be to make the `;' a `&&':
>>
>> pushd()
>> {
>>     builtin pushd "$@" >/dev/null && dirs -v
>> }
>>
>>   
> Maybe add 'builtin' before "dirs" since we're redefining builtins
> (i.e. get into habit?)

Sure, if there's a chance there's a function named `dirs' and you *don't*
want to use it, this is good practice.

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



reply via email to

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