Tuesday, May 12, 2020

How to create a new file in shell script with cat EOF

demo>cat test.sh
#!/bin/bash
rm -f temp_config

cat > temp_config <<-EOF
sfdfadfadfadf
dfadfadfad
[xxxx]
xfdfdf
EOF

cat temp_config
ls -lrt temp_config
demo>
demo>./test.sh
sfdfadfadfadf
dfadfadfad
[xxxx]
xfdfdf
-rw-r--r--  1 homenetwork  staff  39 May 12 14:52 temp_config
demo>

No comments:

Post a Comment

Why I stopped publishing blog posts as information provider

Now the AI can generate content. Does that mean the web publishing industry reaches the end? ChatGPT said: ChatGPT Not at all. While AI can ...