Thanks to all the help in the comments, specially @Shawn, I figured out it was that the string had literal single quotes, so it wasn't a path per-se. I found another answer to remove the quotes using eval
. So now I add eval image_file=$image_file
right after inputting the file and we are all set! It also works with paths that don't have spaces, so ready to run!