How to remove carriage return and newline from a variable in shell script

前端 未结 6 1803
挽巷
挽巷 2020-12-01 05:57

I am new to shell script. I am sourcing a file, which is created in Windows and has carriage returns, using the source command. After I source when I append som

6条回答
  •  猫巷女王i
    2020-12-01 07:00

    use this command on your script file after copying it to Linux/Unix

    perl -pi -e 's/\r//' scriptfilename
    

提交回复
热议问题