简体   繁体   English

在.sh文件中使用代码时替换错误

[英]Bad substitution when using code in .sh file

This script is to post in my Facebook page with Reddit post. 该脚本将与Reddit一起发布在我的Facebook页面中。 I got error in this line: 我在这一行有错误:

SUBJECT=$(wget -qO- "${PICTURE::-4}" | perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)(?: - Imgur)?\s*<\/title/si')

You appear to be using a non-POSIX feature in a shell that does not support it. 您似乎在不支持它的shell中使用了非POSIX功能。 (Likely, you are using dash instead of bash .) Try replacing (可能是,您使用dash而不是bash 。)尝试替换

${PICTURE::-4}

with

${PICTURE%????}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM