Terminal app in Mac OS X Lion 10.7 stuck? - bash

Some days ago I tried to create a shell script which would open all the torrents files in my downloads folder. I am not sure if I get the sh file written right, since then I am getting this message:
Last login: Fri May 18 22:54:28 on ttys000
LSOpenURLsWithRole() failed for the application /Users/Alex/Downloads/(Demonoid.me)-Adobe_Master_Collection_CS5_(OS_X)__12302562.8934.torrent
with error -10810 for the files
/Users/Alex/Downloads/Coda_1_6_2_[_Plist]_[Serial]_O-Demonoid.me-O_12302562.8934.torrent,
/Users/Alex/Downloads/Coda_1_7_3_[k'd]-((Demonoid.me))_12302562.8934.torrent,
/Users/Alex/Downloads/[kat.ph]grid.systems.in.graphic.design.josef.muller.brockmann.torrent,
and /Users/Alex/Downloads/[kat.ph]pixie.lott.cry.me.out.mp3.housezz.torrent.
job done
/bin/bash: line 8: end: command not found
[Process completed]
And I can't do anything in Terminal. I don't know what to do. Any insights about it?

Open a terminal and let it hang.
Open the terminal preferences menu (Command-comma).
In the Startup tab, remember your current shell setting.
Choose a shell other than Bash or Sh (e.g. /bin/tcsh — this is a desparation measure, and only temporary).
Close the locked terminal.
Open a new terrminal (Command-N).
That should give you a command prompt.
In that window, edit your .profile or .bashrc or whatever you added the Torrent lines to.
Remove the Torrent-related lines.
Go back to terminal preferences.
Reset the shell to /bin/bash.
Try opening a terminal window once more.
When it comes to trying to add the Torrents again, write a shell script. Debug it. Only put it in your profile when you're sure it is correct, stable, reliable, and doesn't lock your terminal. Then test it with a terminal already open — opening a new terminal to do the test. You've then still got an unlocked terminal you can fix problems with.
If you have a graphical Vim (Gvim or MacVim), you may be able to launch that and then edit your .profile without having to tweak the Terminal preferences.

Related

How to reset that open vim with a clean window in mac's terminal

I encounted a problem after I change the syntax of mac's terminal vim. Right now, when I open vim, it just shows up under many line's of my shell command (screenshot below) instead of like before open a clean window and cannot see my shell command. So how can I reset it back that open my vim that in a clean terminal window?
Finally find out that because of the TERM is not set to xterm, so I fixed this issue by adding export TERM=xterm-color in my .bash_profile file. If you have the same issue, hope this would help.

adb: command not found after restarting OS X

I'm a bit of a noob at this, but every time I restart my machine and update OS X, I lose adb commands in terminal. I'm not sure how or why this happens or how to get them back aside from reinstalling adb tools, but I'm assuming there's a better way.
The adb tools need to be added to the paths so terminal searches the directory the tools are in.
Assuming you are using a bash terminal you edit or create .bash_profile-file that defines the paths to search, in the example below using the nano-editor:
nano ~/.bash_profile
Enter the path to the adb tools as follows:
export PATH=$PATH:/path/to/the/adb/tools
Save the file (CTRL-X, choose Yes on Save), close the terminal window and open up a new one to load the .bash_profile. This should solve your problem.

Emacs editor "locks" out terminal when being used

The issue I am having is when I open a file via emacs it will open another window in the emacs text editor, but lock out the terminal. What I mean by lock out is that the terminal seems to be linked to the window of emacs that had opened up. When I first downloaded the software I did not have this issue and was able to open multiple emacs windows at once but now I have to close out of the current emacs window to open another. Any suggestions on fixing this?
It sounds like you want to have the file pop up in a window when you open it, rather than fill the whole terminal.
If that's the case, you should
install a graphical version of Emacs from http://emacsformacosx.com/
put alias emacs=/Applications/Emacs.app/Contents/MacOS/Emacs in you ~/.bashrc
open files with emacs file.txt &. The file will open in a separate window and you can keep using your terminal

Terminal - How to open window at a certain directory

When I open Terminal on Mac, it starts in the root directory. I don't want to have to type cd to change my directory every time I open terminal, I want to be in that directory to begin with.
How do I make terminal start in a specific directory? Also, how do I make terminal always start full screen and in a particular color?
Also, what is the command to open text mate in terminal?
This perhaps better belongs on Ask Different, but here are two options to start a Terminal session at a particular location:
Open Terminal Preferences to the Settings section, and in the Window tab check the "Run command", and enter cd yourdirectorypath in the command field. It will automatically run for any new Terminal window.
Edit the ~/.bash_profile and add the cd yourdirectorypath line at the end.
As for starting fullscreen, if you quit Terminal with a fullscreen window open, it will launch that way.
You can set colour schemes in the preferences, there are many built-in "profiles".

How to disable/remove Terminal script?

A while ago I wrote a Terminal script that executes cd Desktop every time I start Terminal.
With the release of Lion, this is no longer necessary as Terminal remembers where I last left off. I can't figure out how to disable/delete the script because I can't find it. There are also no options in the Terminal preferences that can help me. How do I disable or delete this script?
Probably controlled by one of the following files in your home directory, which you can edit/delete to remove this behavior:
.bashrc
.bash_profile
.profile

Resources