bash Mac OS X Lion 10.7 中的终端应用程序卡住了?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10660268/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 02:19:01  来源:igfitidea点击:

Terminal app in Mac OS X Lion 10.7 stuck?

bashscriptingterminal

提问by Alex

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:

几天前,我尝试创建一个 shell 脚本,它可以打开我的下载文件夹中的所有种子文件。我不确定我是否正确编写了 sh 文件,从那时起我收到了这条消息:

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?

我不能在终端中做任何事情。我不知道该怎么办。关于它的任何见解?

回答by Jonathan Leffler

  • 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 .profileor .bashrcor 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.
  • 打开一个终端,让它挂起。
  • 打开终端首选项菜单(Command-逗号)。
  • 在 Startup 选项卡中,记住您当前的 shell 设置。
  • 选择 Bash 或 Sh 以外的 shell(例如/bin/tcsh——这是一种绝望的措施,而且只是暂时的)。
  • 关闭锁定的终端。
  • 打开一个新终端(Command-N)。
  • 那应该给你一个命令提示符。
  • 在该窗口中,编辑您的.profile.bashrc您添加 Torrent 行的任何内容。
  • 删除与 Torrent 相关的行。
  • 返回终端首选项。
  • 将外壳重置为/bin/bash.
  • 再次尝试打开终端窗口。

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.

当再次尝试添加 Torrent 时,请编写一个 shell 脚本。调试一下。只有在您确定它正确、稳定、可靠并且不会锁定您的终端时,才将其放入您的个人资料中。然后用一个已经打开的终端测试它——打开一个新的终端来进行测试。然后你仍然有一个解锁的终端,你可以用它来解决问题。

If you have a graphical Vim (Gvim or MacVim), you may be able to launch that and then edit your .profilewithout having to tweak the Terminal preferences.

如果您有图形 Vim(Gvim 或 MacVim),您可以启动它然后编辑您的 Vim,而.profile无需调整终端首选项。