- This error below will be appeared whenever an user copy text file formatted from Windows (LF) to Linux (CRLF):
-
Error:
/bin/bash^M: bad interpreter: No such file or directory.
-
How to fix:
sed -i -e 's/\r$//' scriptname.sh
# Press `Ctrl+V` -> `Ctrl+M` to insert that `^M`:
sed -i -e 's/^M$//' scriptname.sh
- Search by inverse matching pattern with regex:
-
Resource: Stack OverFlow.
-
Syntax:
(?!<pattern>)
.