shell脚本里面执行source命令提示错误

报错:source: not found
原因:sh 和 bash 是不同的 shell,sh中没有 source 命令。所以用 sh 或者 ./ 运行的时候,会提示这个错误

解决办法如下

//原来的脚本

#!/bin/sh

umask 022

source /etc/profile

 

//修改后脚本

#!/bin/bash //修改位置

umask 022

source /etc/profile

 

即可

参考http://oldtang.com/668.html

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:1 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐