I have this little bash script:
readonly imagick_extension=$(cat "${php_configuration_file}" | grep imagick)
echo "Imagick extension grep value: $imagick_extension"
if [ "${imagick_extension}" != "extension=imagick.so" ]; then
echo "ERROR: Imagick PHP extension is not enabled!"
exit 1
fi
echo "Imagick PHP extension is enabled."
And the output is:
Imagick extension grep value: extension=imagick.so
ERROR: Imagick PHP extension is not enabled!
How is this possible?
It says that the variable's value IS
extension=imagick.so
,but it still goes into the if clause where it should only go if it ISN'T
extension=imagick.so
Thanks in advance!
echo "Imagick extension grep value: < $imagick_extension >"
and looking to see if the output is>agick extension grep value: extension=imagick.so
(notice the first couple of characters) – Chris Davies May 20 '22 at 09:15dos2unix
over the file, it will correct the line-endings for Unix/Linux use. – AdminBee May 20 '22 at 09:27readonly imagick_extension='extension=imagick.so '
. – ilkkachu May 20 '22 at 09:36