I think you could write a script like
#!/bin/bash #bash_run_unixified #unixify and run in bash dos2unix < "$1" | /bin/bash
and assuming you saved it in / urs / local / bin / bash _run_unixified with the appropriate permissions ( sudo chmod o+r,o+x ), you can attach your scripts with
#!/usr/local/bin/bash_run_unixified
If you do not need such unusual shebang lines, you could
$ ln -s /usr/local/bin/{bash_run_unixified,bash}
and then use (As Walter A. notes, it would be nice to associate it with bash^M )
#!/usr/bin/env bash
since your line is shebang ( /usr/local/bin/ usually closer to the beginning of your $PATH than /bin , so the env command should select bash , which refers to bash_run_unixified ).
(Caution: I have not tested anything)
source share