J'écris un script bash pour rechercher un fichier s'il n'existe pas, puis créez-le et ajoutez-y ceci :
Host localhost
ForwardAgent yes
Donc "line then new line 'tab' then text"
Je pense que c'est un format sensible.
Je sais que vous pouvez faire ceci :
cat temp.txt >> data.txt
Mais ça semble bizarre depuis ses deux lignes. Existe-t-il un moyen d'ajouter cela dans ce format :
echo "hello" >> greetings.txt
Réponse acceptée :
# possibility 1:
echo "line 1" >> greetings.txt
echo "line 2" >> greetings.txt
# possibility 2:
echo "line 1
line 2" >> greetings.txt
# possibility 3:
cat <<EOT >> greetings.txt
line 1
line 2
EOT
Si sudo (autres privilèges utilisateur) est nécessaire pour écrire dans le fichier, utilisez ceci :
# possibility 1:
echo "line 1" | sudo tee -a greetings.txt > /dev/null
# possibility 3:
sudo tee -a greetings.txt > /dev/null <<EOT
line 1
line 2
EOT