帮助基本的shell脚本./ bin/sh:source:not found

Thi*_*ode 22 bash shell cron

我的cron:

45 10 * * * source /home/ThinkCode/Test/hello.sh
Run Code Online (Sandbox Code Playgroud)

hello.sh:

#!/bin/bash
echo "helloworld"
Run Code Online (Sandbox Code Playgroud)

它通过电子邮件向我发送错误:

/bin/sh: source: not found
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?它是配置/环境特定的,所以谷歌搜索没有多大帮助!谢谢..

Ign*_*ams 65

真实sh没有source,只有..要么将cron中的shell更改为bash,要么.改为使用.

  • 你用这行:`SHELL =/bin/bash`来做到这一点 (6认同)

Edw*_*ale 10

你为什么source要从cron获取文件.为什么不执行呢?