开发者

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. My .profile just contains a few exports.

[rob@mypc:/home/rob]cd apps
-bash: print: command not found
[rob@mypc:/开发者_Python百科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:

alias


use printf or echo


Change the occurence of print in ~/.profile, ~/.bash_profile, or /etc/profile (system wide) to echo.


Look in your .bash_profile and .bashrc and see if anything is using the print command.


Substitute print with printf. At least in my case, I had the following in .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, i.e., \e]1;new tab name\a, but when I used printf, then it worked as expected.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜