bug-bash
[Top][All Lists]
Advanced

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

Re: Bash Feature Proposal


From: Félix Hauri
Subject: Re: Bash Feature Proposal
Date: Tue, 17 Feb 2026 09:21:40 +0100

Oups!

Le Tue, Feb 17, 2026 at 09:14:00AM +0100, Félix Hauri via Bug reports for the 
GNU Bourne Again SHell a écrit :
> So my purpose, (with lot of bashisms):
> ...
>                 eval builtin cd ${_cd_upDir// /..\/}
> ...

eval is not required here!

cd() { 
    [[ ${1::1} == - ]] &&
      case ${1:1} in 
        '' | *[^0-9]*) ;;
        *)
            local _cd_upDir
            printf -v _cd_upDir '%*s' ${1:1}
            builtin cd ${_cd_upDir// /..\/}
            return $?
        ;;
    esac
    builtin cd "$@"
}

Sorry!

-- 
 Félix Hauri  -  <felix@f-hauri.ch>  -  http://www.f-hauri.ch




reply via email to

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