未找到命令 -sh: shell 脚本错误
我有一个 shell 脚本来从输入文件的标头中提取日期值,但它失败并出现命令未找到错误: 您能否指导我这里
#!/bin/sh
if [ -f input.txt ]; then
echo "FILE exists."
Header_date = $(cut -c8-25 input.txt | head -1)
echo -e " header date value is : $Header_date"
else
echo "$FILE does not exist."
fi
错误:
FILE exists.
-sh: Header_date: command not found
header date value is :
I have a shell script to extract a date value from header of the input file, but it is failing with command not found error:
Could you please guide me here
#!/bin/sh
if [ -f input.txt ]; then
echo "FILE exists."
Header_date = $(cut -c8-25 input.txt | head -1)
echo -e " header date value is : $Header_date"
else
echo "$FILE does not exist."
fi
error:
FILE exists.
-sh: Header_date: command not found
header date value is :
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Header_date = $(cut -c8-25 input.txt | head -1)
行=
前后不允许有空格The spaces before and after
=
on lineHeader_date = $(cut -c8-25 input.txt | head -1)
are not allowed