I wrote a program which is supposed to search through one long string of random digits to find the longest decimal depiction of pi (but no longer than 9). The code is:
read -p 'Please specify one: ' fil1
dire=$( locate $fil1 )
if[ <grep -o '314159265' $dire | wc -w> -gt 0 ]
then
echo The longest decimal representation has 9 digits.
return [0]
fi
if[ <grep -o '31415926' $dire | wc -w> -gt 0 ]
then
etc.
My error message is wc: 0] No such file or directory ./pierex.sh: line 7: grep: No such file or directory
and similarly in every line where these commands occur. What did I do wrong?