I have a little shell script and cannot seem to figure out how to create a simple conditional statement.
big_width=$(($width > 1700))
big_height=$(($height > 1700))
if [ $extension != "jpg" || $big_width || $big_height ]; then
Gives the errors
[: missing ]
0: not found
Also IDK if this will give me what I want. The coniditional should be executed if $extension != "jpg
or if one of the width/height variables are bigger than 1700.
Edit
Trying this code if [[ $extension != "jpg" ]] || ((width > 1700)) || ((height > 1700)); then
gives a height: not found error
. Any idea why the bash syntax is erroring out?
Edit
When I add this to my script
echo $0
echo $SHELL
It prints
source/images/shrink_img.sh
/bin/bash
So bash should be working right? I have no idea why this conditional syntax breaks things. I have tried changing file extensions from .sh
to .bash
and calling the script with bash
instead of sh
too.