pawan rakesh
pawan rakesh

Reputation: 55

Command not found -sh: shell script error

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 :

Upvotes: 0

Views: 1177

Answers (1)

Vesa Karjalainen
Vesa Karjalainen

Reputation: 1107

The spaces before and after = on line Header_date = $(cut -c8-25 input.txt | head -1) are not allowed

Upvotes: 3

Related Questions