sudo: source: command not found

 安装hive、Hbase、pig过程中更新环境变量时出现报错信息sudo: source: command not found。

qiangzi@qiangzi-virtual-machine:/home/qiangzi$ sudo source /etc/profile
[sudo] password for qiangzi: 
sudo: source: command not found

解决办法:

1.输入指令解决 :sudo -s

qiangzi@ubuntu:/home/qiangzi$ sudo -s
root@ubuntu:/home/qiangzi# source /etc/profile

2.如果输入指令后仍出现报错,可能是profile文件丢失

(1)查看相关路径下文件下是否有profile文件(大概率是没有的)。

qiangzi@ubuntu:/usr/local/hadoop-2.10.1/etc/hadoop$ cd /etc
qiangzi@ubuntu:/etc$ ls

(2) 如果没有在该路径下新建文件profile。

qiangzi@ubuntu:/etc$ vi profile

(3) 把以下代码粘贴到新建的profile文件中,保存退出。

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "${PS1-}" ]; then
  if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "$(id -u)" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

马龙强_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值