bash 3.1 gotcha

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

 



For many years, I have had a fancy bash prompt, that contains this:
${PWD/#$HOME/~} This replaces your home dir with a tilde. However, with
bash 3.1, it stopped working:

seg@bigtime:/home/seg
$ rpm -q bash
bash-3.1-2
seg@bigtime:/home/seg
$ echo ${PWD/#$HOME/~}
/home/seg

It works in bash 3.0 and earlier:

seg@hamburger:~
$ rpm -q bash
bash-3.0-31
seg@hamburger:~
$ echo ${PWD/#$HOME/~}
~

I was very confused, until I figured out the ~ was now getting expanded
to $HOME, thus $HOME was getting replaced with $HOME! So escaping the
tilde fixes it:

seg@bigtime:~
$ echo ${PWD/#$HOME/\~}
~

I don't know if this is a bug or not. And may be too obscure for anyone
to care, but there it is.

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux