How can I get this to work?
#!/bin/bash
SOMETHING=$(egrep '^ something' /some/dir/file.conf | awk -F '.' '{print $1}' | awk '{print $2}')
if [ $SOMETHING = 123 ]; then
echo "Found 123"
else
echo "Cannot find 123" && exit 1
fi
Results in grep complaining about a syntax error. It doesn't like the '^ something'
grep|awk|cutshould not the best way to go.SOMETHING=$(egrep '^ something' somefile.conf | awk '{print $4}' | cut -c1-3)above the test, and then just put$SOMETHINGin the test.