开发者

Redirecting standard output to new file adds strange character to end of filename in cygwin

开发者 https://www.devze.com 2022-12-15 15:53 出处:网络
I\'m having trouble with a shell 开发者_StackOverflowscript in Cygwin. The specific command that\'s causing the problem is this:

I'm having trouble with a shell 开发者_StackOverflowscript in Cygwin. The specific command that's causing the problem is this:

sed -e "s/6.0.[0123456789]\{1,\}/6.0.${REV}/g" "path/to/file/config.xml" > "path/to/file/config.xml.tmp"

The problem is that the file is being created with a strange character at the end, so instead of being named config.xml.tmp, it's named "config.xml.tmp". From the "ls" command and from the windows command prompt, it looks like "config.xml.tmp?"

If I run the sed command just from the shell, the file named correctly, and the script works fine in Linux.

Any idea what could be wrong? Thanks!


My guess is that your script file doesn't have UNIX line endings. The \r character in the windows line ending is what's getting added to the end of your filename. You can check with od or hexdump to see if that's the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号