Answer the question
In order to leave comments, you need to log in
How to write to a file not just a string?
Hello. You need to write some data to the file, namely the code. I do this: echo "code" > file
Everything is fine if there is just a string, but when I try to write php code to a file, nothing happens. I thought to transfer to base64, and then decode it, but I'm not sure that there is no more correct way.
Tell me what to do. Thanks in advance.
Answer the question
In order to leave comments, you need to log in
#!/bin/bash
myvar=foobuzz
cat <<EOF >> my_template
# my text
$myvar # вставить значение $myvar
EOF
echo "! Вместо переменной сейчас ее значение"
cat my_template
cat <<'EOF' >> my_copypaste
# my text
$myvar # текст
EOF
echo "! Переменная не заменена на ее значение"
cat my_copypaste
! Вместо переменной сейчас ее значение
# my text
foobuzz # вставить значение foobuzz
! Переменная не заменена на ее значение
# my text
$myvar # текст
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question