Imagine a script which has standard bash linux scripting (running on SUSE linux). Like this:
#!/bin/bash
#version=1.0
#Some other text
command
#-------Comment
Changeversion=2.0
...
...
Is there any way how to automatically deal with errors or at least say a custom message? For example I will try to run the script but it says:
-bash: ./filename.sh: Keine Berechtigung
So I have to add rights to the file - is there any way how to add rights to this file automatically when trying to run it or at least add "custom message" like "do chmod +x filename.sh"?
Or if I have different encoding:
/bin/bash^M: bad interpreter:
Can the script itself run this command:
sed -i -e 's/\r$//' filename.sh
Or at least say it in error message?