0

I am looping through a file that contains tags in the following format:

v10.0.20170216164446
v10.0.20170221122822
v10.0.20170221150333
v10.0.20170224112821
v10.0.20170224113321
v10.0.20170224114206
v10.0.20170224151512
v10.0.20170227181117
v10.0.20170227192857
v10.0.20170228160748

I am doing something as simple as:

while read p; do echo $p; git tag "$p"; done <../filename.txt

Ideally it should be creating all the tags as it parses them, but I get the following error:

v10.0.20170216164446
fatal: 'v10.0.20170216164446?' is not a valid tag name.
v10.0.20170221122822
fatal: 'v10.0.20170221122822?' is not a valid tag name.
v10.0.20170221150333
fatal: 'v10.0.20170221150333?' is not a valid tag name.
v10.0.20170224112821
fatal: 'v10.0.20170224112821?' is not a valid tag name.

I have no idea why it is adding a "?" after each tag. Any ideas on what might be going wrong here?

3
  • Is it possible that the file is untracked in git, thus adding the question mark to the end of the file name? Commented Oct 12, 2017 at 17:30
  • I am not checking in the file though. I just want to add the tags inside it. Commented Oct 12, 2017 at 17:31
  • 2
    The question mark is probably replacing an unprintable character, such as perhaps a carriage-return (^M or \r are various ways to express this that are printable or viewable). If so, removing them from the file you are reading, or stripping them out after reading them, would do the trick. Commented Oct 12, 2017 at 17:31

1 Answer 1

2

Open the file in Notepad++, then go to Edit>EOL Conversion>Unix (LF). That should do the trick.

What is happening, is that at the end of the file there is a carriage return CR. By converting it to Unix EOL conversions, it gets rid of it.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you! I'm wondering if there is a straightforward way to see the line returns in sublime.
I don't think it natively supports it, correct me if I am wrong. I am sure there are plugins that enable you to see it though.
I am sure that there are plugins too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.