rocky-tools icon indicating copy to clipboard operation
rocky-tools copied to clipboard

^M line ends in migrate2rocky.sh results in error " /bin/bash^M: bad interpreter: No such file or directory"

Open anowak-ct opened this issue 2 years ago • 3 comments

Reproduce:

  1. git clone https://github.com/rocky-linux/rocky-tools.git
  2. cd rocky-tools/migrate2rocky
  3. chmod 775 migrate2rocky.sh
  4. sudo su
  5. ./migrate2rocky.sh -h Result: bash: ./migrate2rocky.sh: /bin/bash^M: bad interpreter: No such file or directory

Tested with git commit f3fe6d768a6f2f36bcb4a390e17a4f31eff2e499

Obviously, migrate2rocky.sh contains some DOS line endings...

anowak-ct avatar Mar 03 '22 23:03 anowak-ct

After converting migrate2rocky.sh to unix line endings, the script works fine.
You can use the usual tools to convert line endings like dos2unix or tr -d '\015' < dosfile > unixfile

anowak-ct avatar Mar 03 '22 23:03 anowak-ct

I am unable to reproduce this issue. What output (if any) do you get from this command: git config --global --get core.autocrlf

pajamian avatar Apr 19 '22 12:04 pajamian

  • Same here as @pajamian, please close this issue.
  • Command I used to scan the .sh files for the verification.
find .  -name "*.sh" | xargs file | grep "CRLF"

tjyang avatar Dec 23 '22 17:12 tjyang