The >> operator redirects output to a file and the output will be appended at the end of the file.

 

You can use the echo command to append the text to the end of the file as shown.

# echo "/mnt/pg_master/wal_archives 10.20.20.5(rw,sync,no_root_squash)" >> /etc/exports

 

Alternatively, you can use the printf command (do not forget to use \n character to add the next line).

# printf "/mnt/pg_master/wal_archives 10.20.20.5(rw,sync,no_root_squash)\n" >> /etc/exports

 

The tee command copies text from standard input and pastes/writes it to standard output and files. You can use its -a flag to append text to the end of a file as shown.

# echo "/mnt/pg_master/wal_archives 10.20.20.5(rw,sync,no_root_squash)" | tee -a /etc/exports

OR

# cat shares.txt | tee -a /etc/exports

 

 

 

Was dit antwoord nuttig? 0 gebruikers vonden dit artikel nuttig (0 Stemmen)