cron 作业无法从 bashrc 获取函数

cron job can't source functions from bashrc

crontab -e:

30 22 * * 7 ~/bin/cron_run.sh

~/bin/cron_run.sh:

#!/bin/bash

source ~/.bashrc
#run_this_function is defined in a script sourced by bashrc
run_this_function 

run_this_function 未找到。这里发生了什么?

尝试将 source ~/.bashrc 更改为 . ~/.bashrc

该更改将重新加载 bashrc 的内容。

然后 run_this_function 应该可用...如果它被正确分配为别名。

你有run_this_function声明吗? - 如果可以,请post。