启动终端时出错:“ - bash:QSTK / local.sh:没有这样的文件或目录”

时间:2013-11-18 08:17:52

标签: command-line terminal

“ - bash:QSTK / local.sh:没有这样的文件或目录”

我这个错误已经超过一年了。知道我该如何解决这个问题吗?关于SO的类似建议都没有解决这个问题。

回应Olivier的建议:

当我跑步时

grep QSTK/local\.sh'  /etc/*   ~/.??*

我得到了这个输出:

grep: /etc/aliases.db: Permission denied
grep: /etc/kcpassword: Permission denied
grep: /etc/krb5.keytab: Permission denied
grep: /etc/master.passwd: Permission denied
grep: /etc/sudoers: Permission denied
/Users/DylanRichards/.bash_profile:source QSTK/local.sh
/Users/DylanRichards/.bash_profile.pysave:source QSTK/local.sh
/Users/DylanRichards/.profile:source QSTK/local.sh
Dylan-Richardss-MacBook-Pro:~ DylanRichards$ 

当我输入

-type f -size -200 -print0 2>/dev/null | xargs -0 grep 'QSTK/local\.sh' /dev/null

它什么都不返回。错误仍在我的终端开始时发生。

2 个答案:

答案 0 :(得分:0)

根据您对我的问题的回答:

首先在shell的启动脚本中查找负责的脚本:

grep 'QSTK/local\.sh'  /etc/*   ~/.??*

如果还不够:

find / -type f -size -200 -print0 2>/dev/null | xargs -0 grep 'QSTK/local\.sh' /dev/null

(只需复制/粘贴此内容,同时在终端窗口中以root身份进行登录,以便您可以grep大多数文件)

(附加的“/ dev / null”是强制grep显示匹配文件的名称,即使只有一个参数,如果xargs以一种使最后一个文件单独的方式分割,则会发生这种情况)

(我只检查小于100kb [100 x 512字节]的文件,因为更大的东西很可能是二进制而不是脚本......)

请注意,如果“QSTK”位于变量中,或者构造完成,则可能会失败...

但它可以奏效。尝试一下,如果您不知道如何继续,请告诉我们是否足以纠正错误,或提供额外的信息。

=== update =====================

发布后:

/Users/DylanRichards/.bash_profile:source QSTK/local.sh
/Users/DylanRichards/.bash_profile.pysave:source QSTK/local.sh
/Users/DylanRichards/.profile:source QSTK/local.sh

我建议你

  • 1)检查您确实有/Users/DylanRichards/QSTK/local.sh个文件。

    ls -l /Users/DylanRichards/QSTK/local.sh

  • 2)检查其内容并确保您每次登录时都可以执行

    more /Users/DylanRichards/QSTK/local.sh

  • 3)如果可以执行它(即如果它真的是你真正需要/想要在每次登录时执行的话)那么

    chmod +x /Users/DylanRichards/QSTK/local.sh  ls -al /Users/DylanRichards/QSTK/local.sh

如果需要,您可以发布ls -l /Users/DylanRichards/QSTK/local.sh

的信息

但至于其内容,请验证它(如果它可能包含重要的安全信息,请不要在此发布...)。 (如果您认为向我们展示它是安全的,您可以发布:cat /Users/DylanRichards/QSTK/local.sh(除非它超过20行...)

最后,如果你在/Users/DylanRichards/QSTK/local.sh中找不到该文件:

find / -type f -name "local.sh" -print 2>/dev/null | grep QSTK/local.sh

会告诉你它在哪里。再次检查其内容,如果看起来很好(并且需要),请使用正确文件的正确路径编辑〜/ .bash_profile和〜/ .profile。

答案 1 :(得分:0)

使用文本编辑器打开.bashrc文件,如下所示

$ gedit .bashrc

在文本文件中查找路径.QSTK / local.sh可能在最后一行中您可能类似于 VIRTUAL_ENV_DISABLE_PROMPT = 1来源/home/QSTK/local.sh

注释掉行的开头添加#的行,然后保存

试一试