Ok so I want to write a bashfile system that tells a larger program that a file outputs this error message from chmod.
bash: ./\[bashfile-name\].sh: /bin/bash^M: bad interpreter: No such file or directory
Here's the relevant part of the code, format is bashfile.
error=$(chmod +x $fdnm 2\>&1 \> /dev/null)
echo "value for error was "$error
if \[ $error = "bash "$filename": /bin/bash^M: bad interpreter: No such file or directory" ]
^^this is line 24^^
then
echo "patch would be done"
else
echo "the file appears to be executable."
fi
Got this as output
value for error was chmod: cannot access '/media/usb/run-bi.sh'$'\r': No such file or directory
the file appears to be executable.
with these errors
./bad-interpreter.sh: line 24: [: too many arguments
chmod: missing operand after ‘+x’
Try 'chmod --help' for more information.
please debug. Thank you all.