I want to get a date from a file name. This works using this code:
for filename in OH/*
do
echo $filename |grep -Eo '[[:digit:]]{14}'
done;
Now i want to save the result to a variable like this:
for filename in OH/*
do
result=$($filename |grep -Eo '[[:digit:]]{14}')
echo $result
done;
But i get 2 empty lines printed. What am i missing there?