Search code examples
makefilegnu-makenmake

Cannot write redirection symbol(>>) to text file using nmake


I have a make file which outputs some data to a text file. Commands shown below:

@echo HOURS >> 123.txt
@echo MINUTES >> 123.txt
@echo SECONDS >> 123.txt      

As of now the 123.txt file contains
HOURS
MINUTES
SECONDS

I would like to append a text such as >> to the end of the 123.txt file. How to do it. I tried with the command @echo >> >> 123.txt but it is not successful, a blank line is written to 123.txt file. The desired output file should be:
HOURS
MINUTES
SECONDS >>
Can anyone help me on this how to add ">>" to end of the file.

Thanks


Solution

  • The way to do this:

    @echo HOURS >> 123.txt
    @echo MINUTES >> 123.txt
    @echo SECONDS^>^> >> 123.txt
    

    '^' is the escape character for CMD