安装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空间的建立

  • 4
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值