安装zsh之后roscore等ros相关命令(比如catkin_init_workspace和source命令等)全部失效解决办法

source的时候报错!!!

~ source ~/.bashrc
/home/hri/.bashrc:16: command not found: shopt
/home/hri/.bashrc:24: command not found: shopt
/home/hri/.bashrc:111: command not found: shopt
/usr/share/bash-completion/bash_completion:51: command not found: shopt
/usr/share/bash-completion/bash_completion:57: command not found: complete
/usr/share/bash-completion/bash_completion:62: command not found: complete
/usr/share/bash-completion/bash_completion:65: command not found: complete
/usr/share/bash-completion/bash_completion:68: command not found: complete
/usr/share/bash-completion/bash_completion:71: command not found: complete
/usr/share/bash-completion/bash_completion:74: command not found: complete
/usr/share/bash-completion/bash_completion:77: command not found: complete
/usr/share/bash-completion/bash_completion:80: command not found: complete
/usr/share/bash-completion/bash_completion:83: command not found: complete
/usr/share/bash-completion/bash_completion:86: command not found: complete
/usr/share/bash-completion/bash_completion:89: command not found: complete
/usr/share/bash-completion/bash_completion:92: command not found: complete
/usr/share/bash-completion/bash_completion:314: parse error near \n
/opt/ros/kinetic/setup.bash:.:8: no such file or directory: /home/hri/setup.sh
/opt/ros/kinetic/setup.bash:.:8: no such file or directory: /home/hri/setup.sh
\[\e]0;\u@\h: \w\a\]\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$

产生问题的原因:

主要是看到zsh可以装逼,用了以后其实shell已经不是原来的了,因此当然就不能用了

解决方法:

在~/.zshrc的文件最后面添加:
source /opt/ros/kinetic/setup.zsh
也就是说
原来我们在~/.bashrc最后面添加source /opt/ros/kinetic/setup.bash
现在则需要在~/.zshrc后面添加成source /opt/ros/kinetic/setup.zsh就好了!

再补充一点,

通过上面的方法虽然解决可source命令的问题,也一些基本的ros的命令算是重新出现了,但是还是有一些东西是没有的
比如当我去创建catkin_ws 和 rosbuild_ws工作空间的时候,
想要用命令:catkin_init_workspace的时候还是失败了!
这下懵逼了,

解决办法:

Step1:

~/下面创建一个叫做bash_profile的文件,这里我用的是vim编辑的,也可以用其他的编辑
sudo vim ~/.bash_profile
接着在里面输入export PATH=/bin:/usr/bin:/usr/local/bin:$PATH

Step2:

在.zshrc文件中找到这么一行
# User configuration
然后在其下面输入:
source ~/.bash_profile

之后再source一下.zshrc
然后发现上面说的问题都没有了!
小白的开心!哈哈哈~ha

最后如果同时由catkin_ws和rosbuild_ws的话可以参考这两个链接:
(1)首先是关于zsh对于rosbuild的影响的zsh下的setup.zsh问题
(2)两种workspace的问题参考:catkin_ws + rosbuild_ws空间的建立

你可能感兴趣的:(ROS)