我是shell脚本的新手。我使用在Windows中创建的源命令来源文件,它有回车。在我追加一些字符的时候,它会一直到行的开头。如何从shell脚本中的变量中删除回车符和换行符
test.dat (which has carriage return at end)
testVar=value123
testScript.sh (sorces above file)
source test.dat
echo $testVar got it
我得到的输出是
got it23
我怎样才能把变量的 '\ r'。任何帮助都将非常可观。
由于一吨用于' perl'。我无法下载'dos2unix','tr'不能工作,什么不可以!非常感谢! – 2018-01-26 16:55:52