需要这样source /home/kevin_xie/.bashrc
#!/bin/bash # 注释
source /home/kevin_xie/.bashrc
DATE=$(date +%Y%m%d) # 注释 不然有回车换行
work_path=$(dirname $(readlink -f $0)) # 当前绝对路径
cd $work_path # 注释
file=${work_path}"/hotmapGoMain.py" # 更改为自己要执行的文件名字-----------
source ~/.bashrc # 注释
conda activate py38 # 注释 ---------------
dir=$work_path"/log" # 注释
if [ ! -d $dir ] # 注释
then # 注释
mkdir $dir # 注释
chmod 777 -R ${dir} # 注释
fi # 注释
python ${file} >> ${dir}/start.${DATE}.log 2>&1 & # 打印到日志------------