FAQ
Set up NIS and autofs on this new CentOS6 box, but it seems tilde
expansion no longer works in bash?

[root at frodo ~]# cd ~john
-bash: cd: ~john: No such file or directory
[root at frodo ~]# cd /home/john
[root at frodo john]# pwd
/home/john
[root at frodo john]#

It still works in t/csh:

[root at frodo ~]# /bin/csh
[root at frodo ~]# cd ~john
[root at frodo ~john]# pwd
/home/john
[root at frodo ~john]#

I couldn't find anything in the bash man page that suggests this
feature needs explicit configuration.

Search Discussions

  • John Hodrien at Jan 5, 2012 at 11:17 am

    On Thu, 5 Jan 2012, isdtor wrote:

    Set up NIS and autofs on this new CentOS6 box, but it seems tilde
    expansion no longer works in bash?

    [root at frodo ~]# cd ~john
    -bash: cd: ~john: No such file or directory
    [root at frodo ~]# cd /home/john
    [root at frodo john]# pwd
    /home/john
    [root at frodo john]#

    It still works in t/csh:

    [root at frodo ~]# /bin/csh
    [root at frodo ~]# cd ~john
    [root at frodo ~john]# pwd
    /home/john
    [root at frodo ~john]#

    I couldn't find anything in the bash man page that suggests this
    feature needs explicit configuration.
    It's not generally true, tilde works just as expected here on C6 with bash.
    Perhaps something's been cached by bash from when NIS was setup incorrectly?

    I'd assume cd ~root would work if that was the case.

    jh
  • Isdtor at Jan 5, 2012 at 11:32 am

    It's not generally true, tilde works just as expected here on C6 with bash.
    Perhaps something's been cached by bash from when NIS was setup incorrectly?
    That's most likely it. All is working fine after a reboot.
    I'd assume cd ~root would work if that was the case.
    It does.
  • Mark Roth at Jan 5, 2012 at 11:23 am

    isdtor wrote:
    Set up NIS and autofs on this new CentOS6 box, but it seems tilde
    expansion no longer works in bash?

    [root at frodo ~]# cd ~john
    -bash: cd: ~john: No such file or directory
    [root at frodo ~]# cd /home/john
    <snip>
    Works jes' fine for me. There's something either in your environment, or
    some option that's gotten munged. Please note what you pasted: the PS1
    shows you being in your home... with a tilde.

    mark

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcentos @
categoriescentos
postedJan 5, '12 at 11:10a
activeJan 5, '12 at 11:32a
posts4
users3
websitecentos.org
irc#centos

3 users in discussion

Isdtor: 2 posts Mark Roth: 1 post John Hodrien: 1 post

People

Translate

site design / logo © 2022 Grokbase