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 :
CodePudding user response:
The spaces before and after =
on line Header_date = $(cut -c8-25 input.txt | head -1)
are not allowed