Skip to content

Instantly share code, notes, and snippets.

@jamesbowman
Created January 30, 2018 16:35
Show Gist options
  • Save jamesbowman/935b275eaa356ac66268f3481d06e6bd to your computer and use it in GitHub Desktop.
Save jamesbowman/935b275eaa356ac66268f3481d06e6bd to your computer and use it in GitHub Desktop.
/data/backup/$TODAY#!/bin/bash -e
read -r YESTERDAY TODAY <<<$(
python3 -c '
import datetime
def day_to_slot(n):
return bin(n)[::-1].index("1")
n = datetime.date.today().toordinal()
print(day_to_slot(n - 1))
print(day_to_slot(n))
')
rsync -avz --link-dest=/data/backup/$YESTERDAY ~ remote:/data/backup/$TODAY
ssh remote touch /data/backup/$TODAY
@minimo24
Copy link

minimo24 commented Jul 8, 2018

What is the meaning of "/data/backup/$TODAY#!/bin/bash -e" on the first line of the script? I get the #!/bin/bash part but wonder about $TODAY. Seems to be an environment variable like $PATH but nothing is displayed with "echo $TODAY" .

@RGD2
Copy link

RGD2 commented Apr 27, 2019

James explains it over here

The stuff before the # on the first line I think is just a mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment