Re: Bash Feature Proposal

Félix Hauri via Bug reports for the GNU Bourne Again SHell <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Message-ID <[email protected]>
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  -  <[email protected]>  -  http://www.f-hauri.ch
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.