No configuration file ~/.bashrc in Bash.



  • I have installed Bash on my pfSense v2.3:

    [luis@pfSense-ThreepWood ~]$ bash --version
    GNU bash, version 4.3.42(1)-release (amd64-portbld-freebsd10.2)
    Copyright (C) 2013 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http: gnu.org="" licenses="" gpl.html="">
    
    This is free software; you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.</http:>
    

    And would like to customize it, but I have found no "~/.bashrc" file:

    [luis@pfSense-ThreepWood ~]$ pwd
    /home/luis
    [luis@pfSense-ThreepWood ~]$ ls -la
    total 56
    drwxr-xr-x  4 luis  luis   512 Jan 10 00:54 .
    drwxr-xr-x  3 root  wheel  512 Jan  9 14:49 ..
    -rw-------  1 luis  luis   564 Jan 10 00:54 .bash_history
    -rw-r--r--  1 luis  luis   994 Jan  6 17:18 .cshrc
    -rw-r--r--  1 luis  luis   186 Jan  6 17:18 .login
    -rw-r--r--  1 luis  luis    91 Jan  6 17:18 .login_conf
    -rw-------  1 luis  luis   301 Jan  6 17:18 .mail_aliases
    -rw-r--r--  1 luis  luis   267 Jan  6 17:18 .mailrc
    -rw-r--r--  1 luis  luis   743 Jan  6 17:18 .profile
    -rw-------  1 luis  luis   212 Jan  6 17:18 .rhosts
    -rw-r--r--  1 luis  luis   909 Jan  6 17:18 .shrc
    drwx------  2 luis  luis   512 Jan  7 14:16 .ssh
    drwxr-xr-x  2 luis  luis   512 Jan  7 14:07 Temporal
    

    So I have created it and added my PS1 customization command (that works OK from shell):

    nano ~/.bashrc
    export PS1="${debian_chroot:+($debian_chroot)}[\033[00;32m]\u@\h[\033[00m]:[\033[01;34m]\w[\033[00m]\$ "
    

    But, after logout (and even after reboot), the prompt has not changed, so I suppose the "~/.bashrc" file is ignored.

    How can I do to make this file to be read?
    If this is not the proper file in this version of Bash, where may I customize my shell (things like adding alias or environment variables)?

    (Should this question go to a generic FreeBSD forum, or can it fit here? I don't know if this an issue only for pfSense)


  • Rebel Alliance Developer Netgate

    A general FreeBSD forum would be better for that but it's not a really complicated issue.

    It depends on how you login and/or how the shell starts. Try making .bash_profile instead, or linking the two.



  • @jimp:

    A general FreeBSD forum would be better for that but it's not a really complicated issue.

    It depends on how you login and/or how the shell starts. Try making .bash_profile instead, or linking the two.

    Indeed, this worked:

    $ mv .bashrc .bash_profile
    

    I will anyway ask on a FreeBSD forum and post the link here, for those interested.
    Thanks you.


Log in to reply