简体   繁体   English

bash:打印:找不到命令

[英]bash: print: command not found

I've just added a.profile to my bash shell. However, I've noticed the error "-bash: print: commant not found" keeps on appearing even if you are changing to a valid directory.我刚刚将 a.profile 添加到我的 bash shell。但是,我注意到错误“-bash: print: commant not found”一直出现,即使您正在更改到有效目录。 My.profile just contains a few exports. My.profile 只包含一些导出。

[rob@mypc:/home/rob]cd apps
-bash: print: command not found
[rob@mypc:/home/rob/apps]cd util
-bash: print: command not found
[rob@mypc:/home/rob/apps/util]

Can anyone point out why this error keeps on showing?谁能指出为什么这个错误不断出现?

Check the output of: 检查输出:

echo $PROMPT_COMMAND

it might give some clues, or else you might have cd aliased to something, so check the output of: 它可能会给出一些线索,否则你可能会把cd别名到某个东西,所以检查输出:

alias

使用printfecho

查看.bash_profile和.bashrc,看看是否有任何东西正在使用print命令。

~/.profile~/.bash_profile/etc/profile (系统范围)中的print出现更改为echo

Substitute print with printf .printf代替print At least in my case, I had the following in .bash_profile至少就我而言,我在.bash_profile中有以下内容

function tabname {
  print "\e]1;$1\a"
}

to change the name of a Terminal tab.更改终端选项卡的名称。 When I tried changing print to echo , it just echoed the text exactly, ie, \e]1;new tab name\a , but when I used printf , then it worked as expected.当我尝试将print更改为echo时,它只是准确地回显了文本,即\e]1;new tab name\a ,但是当我使用printf时,它按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM