Answer the question
In order to leave comments, you need to log in
How to write multiple lines to a bash file?
Tell me how you can write multiple lines to a file through the command line?
Example:
echo “
«Строка 1
Строка 2
Строка3» >> /home/2.txt
Answer the question
In order to leave comments, you need to log in
cat << EOF > your_file.txt
str1
str2
str3
EOF
echo "str1
str2
str3" >> myfile.txt
cat > /etc/sysconfig/network-scripts/ifcfg-"${nameINT}" <<EOF
NAME="${nameINT}"
DEVICE="${nameINT}"
BOOTPROTO=static
UUID="${uuid}"
ONBOOT=yes
IPADDR="${1}"
NETMASK="${NETMASK}"
EOF
you can also do this if the lines are short
printf "str1\nstr2\nstr3" >> /home/2.txt
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question