Here is a simple (and maybe dummy) question in an as-simple-as-the-question scenario.
I want to store my output file in a variable :
#!/bin/bash
LOG=/var/log/myown/backup.log
So I can build my script this way:
#!/bin/bash
LOG=/var/log/myown/backup.log
echo "Backup créé le $(date)" >>$LOG
Also, I'd like to make this possible for the LOG variable to point to STDOUT.
Then I could simply change the value of LOG
as in LOG=&1
so it does not writeout to a file but to STDOUT.
&1
, but with modern versions of bash you can use1
(the&
needs to be syntax rather than data).