PDA

View Full Version : Terminal won't login (does seperate script)




noahgolm
Dec 4, 2010, 10:23 PM
Hi, I was making a simple bash script which showed hidden files in finder, and apparently something went wrong. I tried to move the file into the /bin folder to make it executable without the ./, but i don't know if that's what is wrong here. It seems that whenever I open terminal now, it tries to run that script, then displaying the "process complete" line and staying there. I had quit the script once in the middle of it, and heard this can happen sometimes because of that. Is there any way of fixing this? I tried deleting the com.apple.Terminal.plist file, but it did no good...



ulbador
Dec 4, 2010, 10:31 PM
Hi, I was making a simple bash script which showed hidden files in finder, and apparently something went wrong. I tried to move the file into the /bin folder to make it executable without the ./, but i don't know if that's what is wrong here. It seems that whenever I open terminal now, it tries to run that script, then displaying the "process complete" line and staying there. I had quit the script once in the middle of it, and heard this can happen sometimes because of that. Is there any way of fixing this? I tried deleting the com.apple.Terminal.plist file, but it did no good...

From the Finder, Click the Go menu and Go to Folder option. Put /bin or /usr/bin (whichever folder you made your script in) and click Go. Move your script to either the Trash or out of that folder to the Desktop or something.

Now when you start up the Terminal, it will give you an error until you remove the reference to the script from whichever file you put it in, but at least your terminal will load.

You could also tell Terminal to start with /bin/zsh instead of the default shell, but that would only work if you had put your reference to your broken script in once of the bash specific files like bashrc or bash_profile

noahgolm
Dec 4, 2010, 10:38 PM
Aaaagh! I just looked at the /bin/bash script in my text editor, and its contents are the script I made! It's running that instead of the normal bash! Is there any way to restore this?

ulbador
Dec 4, 2010, 10:44 PM
Aaaagh! I just looked at the /bin/bash script in my text editor, and its contents are the script I made! It's running that instead of the normal bash! Is there any way to restore this?

Ouch! You messed up.. What Mac OS version and computer type are you on? You are going to have to replace that it with the proper binary. Otherwise you'll have to switch from bash to zsh or something

I could send you my bash binary, but that will only work if you are on Snow Leopard.

I've attached it. Double click it to unzip and drag it to your /bin directory.

noahgolm
Dec 4, 2010, 10:50 PM
Well, I'm running Snow Leopard on a late 2008 Macbook. With a little bit of specifics, I'm running 10.6.4, have a 160GB hardrive, and 2GB of RAM. And a screwed up bash script. Thank you!

ulbador
Dec 4, 2010, 10:51 PM
I edited my last post and attached a zip file containing that bash file. We appear to be on the same OS version

noahgolm
Dec 4, 2010, 10:55 PM
Thank you so much! You're a real lifesaver here. Works just fine now!

mac2x
Dec 5, 2010, 02:31 AM
Case in point of why the command line can be dangerous. You simply have to pay attention to what you are doing where. Use the pwd command liberally! Common commands like ls conveniently echo $PWD automatically.

subsonix
Dec 5, 2010, 02:50 PM
Good to hear that it went well in the end. It's never a good idea to store your own scripts in /bin or other reserved places for os binaries. Use /usr/local/bin or your own purpose made folder that you then add to the PATH environment variable.

mac2x
Dec 5, 2010, 03:08 PM
Good to hear that it went well in the end. It's never a good idea to store your own scripts in /bin or other reserved places for os binaries. Use /usr/local/bin or your own folder that you then add to the PATH environment variable.

This.

I have my own bin in my home folder. Simply make one, and add this to your .bash_profile:

export PATH=$PATH:$HOME/bin