Question
Snapshot List outputs in file and email as single line
I’m looking to develop a script where the Snapshot list is emailed to someone.
When I run doctl compute droplet snapshots $dropletid
, I get the following:
ID Name Type Distribution Slug Public Min Disk
61003635 test-droplet_2020-03-22-Sun@17:34-CDT snapshot Ubuntu false 25
61004052 test-droplet_2020-03-22-Sun@17:46-CDT snapshot Ubuntu false 25
61004228 test-droplet_2020-03-22-Sun@17:52-CDT snapshot Ubuntu false 25
61005132 test-droplet_2020-03-22-Sun@18:07-CDT snapshot Ubuntu false 25
61005281 test-droplet_2020-03-22-Sun@18:11-CDT snapshot Ubuntu false 25
61007940 test-droplet_2020-03-22-Sun@19:04-CDT snapshot Ubuntu false 25
However, when I echo that to an email, with this sudo /snap/bin/doctl compute droplet snapshots $dropletid >> $email_notification
, I get the following in the email:
ID Name Type Distribution Slug Public Min Disk 61003635 test-droplet_2020-03-22-Sun@17:34-CDT snapshot Ubuntu false 25 61004052 test-droplet_2020-03-22-Sun@17:46-CDT snapshot Ubuntu false 25 61004228 test-droplet_2020-03-22-Sun@17:52-CDT snapshot Ubuntu false 25 61005132 test-droplet_2020-03-22-Sun@18:07-CDT snapshot Ubuntu false 25 61005281 test-droplet_2020-03-22-Sun@18:11-CDT snapshot Ubuntu false 25 61007940 test-droplet_2020-03-22-Sun@19:04-CDT snapshot Ubuntu false 25 61008918 test-droplet_2020-03-22-Sun@19:15-CDT snapshot Ubuntu false 25
Instead of the output being on one line, I want the output to be on as many lines as being requested.
Is there something I’m missing?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×