File with Control-m characters

linux

Solution

open the file in vi editor

press escape and type below on command line in the file.

:%s/^M//g

make sure ^M is added by hitting Cntrl key + V + M then hit enter

it will remove the characters and you can save the file.

Problem

we are working on windows machine and code is deployed in linux. Some how while developing some linux scripts we have some ctrl-m character. release is provided to customer. what can be the impact on ctrl-m characters in shell scripts. nus

Original source