osx - Execute command in script based on year -
i have powerbook dead laptop battery... everytime disconnect it's power source date gets set year 1969. leads issues network authentication, keychain access, etc. wrote launch daemon executes script in order set date more appropriate @ boot, works fantastically.
#!/bin/bash date 0101122014
now want run if year 1969, way if time correct won't set @ all.
so like...
#!/bin/bash year="date +%y" if [ $year = 1969 ] ; date 010112002014 else exit 0 fi
i know syntax totally off, it's give idea of want do. in advance.
use command substitution:
year=$(date +%y)
or even:
[ $(date +%y) = 1969 ] && date 010112002014
or, using if
:
if [ $(date +%y) = 1969 ] date 010112002014 fi
Comments
Post a Comment