When editing a script from windows, either a simple text file in notepad, for some reason we appends DOS characters as ^ M. Previously I had made a perl script that could eliminate these hidden characters of DOS / Windows, but searching the Internet I found this:

file: undus.sh
  #! / bin / sh 
  # Script written by Crista Szmajda 

  if [$ #-eq 0]; then 
  echo "Usage: Undos" 
 fi 

  for file 
 do 
  tr-d '\ 015' <$ file> / tmp / .undos. $ $ 
  mv / tmp / .undos. $ $ $ file 
 done 

Running the script

To use the script to remove the characters undus ^ M to a file type to run this script from the console:

  fher98 @ deathbian: ~ $ Undos <file> 


This script is very useful if we do not have dos2unix tools.

Popularity: 5% [?]