Bash 在.sh文件中使用代码时替换错误
此脚本将使用Reddit post在我的Facebook页面上发布。我在这行中遇到了错误:Bash 在.sh文件中使用代码时替换错误,bash,Bash,此脚本将使用Reddit post在我的Facebook页面上发布。我在这行中遇到了错误: SUBJECT=$(wget -qO- "${PICTURE::-4}" | perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)(?: - Imgur)?\s*<\/title/si') SUBJECT=$(wget-qO-“${PICTURE::-4}”| perl-l-0777-ne'print$1 if/\s*(.*)(--Img
SUBJECT=$(wget -qO- "${PICTURE::-4}" | perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)(?: - Imgur)?\s*<\/title/si')
SUBJECT=$(wget-qO-“${PICTURE::-4}”| perl-l-0777-ne'print$1 if/\s*(.*)(--Imgur)?\s*您似乎在一个不支持它的shell中使用了一个非POSIX特性。(很可能,您使用的是dash
而不是bash
)尝试替换它
${PICTURE::-4}
与
您得到了什么错误?错误消息是一段文本。这是经过设计的。它是用来读取的。错误:错误替换您可能使用了dash
而不是bash
;${PICTURE::-4}
不在POSIX shell规范中。
${PICTURE%????}