My notepad

Chris' IT notes…
← Back

cat: create/write file

Create file without replacing variables:

sh
cat <<'EOF' > /path/file
============================
My name is ${0}
I was input via user data
============================
EOF

If you check /path/file you will see exactly the content above. Create file REPLACING the variables while creating:

sh
cat <<EOF > /path/file
============================
My name is ${0}
I was input via user data
============================
EOF

In this example, the variable ${0} will be replaced during the creation of the file, hence the content will display your username.