Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Apps lost under bash shell

Apps lost under bash shell
Thread Tools
Fresh-Faced Recruit
Join Date: Jan 2000
Location: Oakland, CA, USA
Status: Offline
Reply With Quote
May 22, 2004, 07:47 PM
 
I just changed my shell from tcsh to bash. I'm learning Unix, and the book that I have references bash functions that I can't get to work through the tcsh shell. I guess tcsh was installed through Jaguar, but why wasn't this changed to bash when I installed Panther?

Anyway, I went into the NetInfo Manager/Update/Utility (can't remember the name) to change the default shell from tcsh to bash, and while the Terminal now loads with a bash prompt, I can't get any of the apps that were installed in tcsh to run under bash. They all come back as "command not found." I've rehashed and restarted the Terminal, but to no avail. Also, any changes made to a .profile or a .bashrc file are not recognized by the shell.

Can someone give me a little guidance as to how to get all my applications working again?

As I mentioned, I'm using Panther 10.3.3.

Thank you,
Michael
Le ver vert va vers le verre vert.
     
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
May 23, 2004, 10:07 AM
 
What apps are you referring to? Resources like fink add a command to the configuration file for your default shell when they are first installed. It sounds like the path that bash needs to 'find' applications you have installed with the tcsh shell is not set. You probably have the information needed in a file in your home directory named .tcshrc. From the Terminal enter the command
Code:
ls -al ~/.t*
to get a listing that would include .tcshrc, if it exists. If it is there, the path info you need is probably in that file.

The command
Code:
cat ~/.tcshrc
will display that file's content. Lines beginning with 'set path' will be the relevant ones. The bash shell uses a file named .bashrc (among others) to get info about paths you want searched when issuing a command. Your book or Google will have info about how to setup this file.

Craig
     
Fresh-Faced Recruit
Join Date: Jan 2000
Location: Oakland, CA, USA
Status: Offline
Reply With Quote
May 23, 2004, 03:40 PM
 
I use Par2 most often, but since I'm just learning the command line, I want to use a lot more of these available apps. Par2 was installed through an installer from the developer. I didn't compile this app myself. I did compile Pan through Fink, I checked the .tcshrc file, and I do see two lines referring to path information, in addition to the aliases that I created. I'll copy these lines to the .bashrc file that I will create. Do you have to delete the .tcshrc file after switching shells? Will the .tcshrc file interfere with the .bashrc file?

Also, will setting PATH (I don't know the correct verbage) correct the reference to applications?

Thanks for your help,
Michael
Le ver vert va vers le verre vert.
     
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
May 23, 2004, 05:37 PM
 
The fink installation detects your default interactive shell- which is the shell that is run when a Terminal window is opened. For csh the line added to .tcshrc is 'source /sw/bin/init.csh' and for bash the line added to .bashrc is 'source /sw/bin/init.sh'. You probably have the first example in your .tcshrc file since fink was installed when you had the csh shell as your default. You do not need to change that or remove the file.

For bash, you create a .bashrc file in your home directory and, since you have fink installed , include the line 'source /sw/bin/init.sh'. You should also include a line that adds the path to your Par2 install. There is not a 'standard' installation directory in OS X for third party apps, so you will need to find out where the installer put it. You should be able to enter 'locate Par2' in the Terminal and have the path of its install returned. If the locate command does not find Par2, you need to rebuild the locate database. You do this by entering 'sudo /etc/weekly' in a terminal window and then your sign on password when prompted. It could take 10 minutes or more for the locate database to be rebuilt after this command. Once done, the 'locate Par2' will return the its path.

To add to the existing $PATH, bash uses the export command. Let's say 'locate' returned the path '/usr/local/bin/Par2'. You would add a line to .bashrc
Code:
export PATH=$PATH:/usr/local/bin
.

There are several text editors available via the Terminal that are included with OS X. I'd suggest using the Pico editor to create the .bashrc file. Make sure you Terminal's working directory is your home directory by entering 'cd'. Then 'pico .bashrc'. You will have an empty .bashrc file created by Pico and can enter the two lines described above--source..etc and export..etc.

After adding them, control-o saves the file and control-x exits Pico and returns you to the bash prompt. Close the Terminal window by entering 'exit'. Open a new window with command-n. You Par2 command should work as well as the fink apps via X11. You open a new Terminal window because the .bashrc file is read when a new session is started and the first window you worked with had been opened before you created the file.

I've added single quotes around commands or lines in files to make this more readable. The single quotes should not be entered as a part of the commands.

Craig
     
Fresh-Faced Recruit
Join Date: Jan 2000
Location: Oakland, CA, USA
Status: Offline
Reply With Quote
May 23, 2004, 06:06 PM
 
Thank you very much. This is great information!

Everything worked out great. All the apps are back to normal.

Michael
(Last edited by mqymouse; May 24, 2004 at 12:50 AM. )
Le ver vert va vers le verre vert.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:49 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2