gpt4 book ai didi

linux - 在 Gnome Scheduler 中运行 Bash 脚本时出现奇怪的 Bash 错误

转载 作者:太空宇宙 更新时间:2023-11-04 03:51:06 25 4
gpt4 key购买 nike

我正在尝试在 Gnome Scheduler 中运行 bash 脚本,但它在程序中运行时拒绝执行已定义的变量,尽管该脚本在终端运行良好。

这是我收到的错误:

"date: extra operand '--date=1 hours ago"

挂起的命令是:

LHR=$(date -u +%H --date="1 hours ago")

脚本的顶部写着:

#!/bin/bash

SHELL=/bin/bash
export PATH=/mnt/grads:$PATH

我做错了什么?

最佳答案

必须转义 % 字符:crontab 条目中的\%。

关于linux - 在 Gnome Scheduler 中运行 Bash 脚本时出现奇怪的 Bash 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26347791/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com