Find the answer to your Linux question:
Results 1 to 4 of 4
Dear all, I hope this is posted in the right place - I'm a new user. I have very recently started using redhat in a tcsh shell and would like ...
  1. #1
    Just Joined!
    Join Date
    Oct 2009
    Posts
    3

    .bashrc help

    Dear all,
    I hope this is posted in the right place - I'm a new user.
    I have very recently started using redhat in a tcsh shell and would like to try the bash shell too.
    What I would like to do is create a .bashrc file so that my aliases etc are introduced at startup (when I type bash -l in the tcsh shell)
    My question is: can I just copy the .cshrc file in my home/usr folder to a .bashrc file?
    What do I have to change for this to be recognised?
    Am I even doing the right thing here? - All I want is to use the permanent aliases I have in the tcsh shell in the bash shell.
    Thank you in advance

    Ben

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    The file ~/.bashrc (the one in your user home directory) is automatically loaded whenever a bash shell is started. The file ~/.bash_profile is executed whenever a login shell is started. Aliases need to be reset whenever a shell is started, so you should put them in ~/.bashrc. However, setting exported environment variables should be done in ~/.bash_profile because exports will be propagated to subshells as well as being set at login. In any case, you should probably get a decent book on bash programming. O'Reilly's Nutshell series has a good one on bash programming that you can get from Amazon, or at most any decent book store, such as Borders or B&N.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Oct 2009
    Posts
    3
    Dear Rubberman,
    Thanks very much, actually I don't have a .bashrc file in my home directory only a .cshrc file, since the shell I am using is a tcsh shell.
    However if I just run the bash shell from it, i.e typing bash into the tcsh shell - can I just write a .bashrc shell and place it in the home directory? Could I just copy the cshrc file and rename it?
    Thanks

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    You don't want to use the .cshrc file since the syntax for bash and tcsh/csh are very different. However, yes you can create your .bashrc file in your home directory, and if you want to start a login shell from tcsh you can with the --login option which will make it read and execute ~/.bash_profile as well.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...