Can linux cat command be used for writing text to file?

后端 未结 12 1245
南方客
南方客 2021-01-29 19:03

Is something like this:

cat \"Some text here.\" > myfile.txt

Possible? Such that the contents of myfile.txt would now be overwr

12条回答
  •  难免孤独
    2021-01-29 19:58

    Write multi-line text with environment variables using echo:

    echo -e "
    Home Directory: $HOME \n
    hello world 1 \n
    hello world 2 \n
    line n... \n
    " > file.txt 
    

提交回复
热议问题