Created
July 29, 2016 20:20
-
-
Save masukomi/8b70ba85998ed5a191552897431393e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extract | |
┌─────────────────this ──────────────────────────┐ | |
│ column │ | |
│ ▼ | |
│ ┌──┐ | |
│ │ │ | |
│ ┌────────────┼──┼───────┐ | |
│ │ July 20│16│ │ | |
│ │Su Mo Tu We │Th│ Fr Sa │ | |
│ │ │ │ 1 2 │ | |
│ generate │ 3 4 5 6 │ 7│ 8 9 │ | |
┌─────────────┼───calendar─────────────────────▶│10 11 12 13 │14│ 15 16 │ | |
┌────────────┼─────────────┼──────────────────────────┐ │17 18 19 20 │21│ 22 23 │ | |
│#!/bin/bash │ │ │ │24 25 26 27 │28│ 29 30 │ | |
│ ┌───┐ ┌────────────────┐ │ │31 │ │ │ | |
│for i in `│cal│ | │awk '{print $5}'│`; do │ └────────────┼──┼───────┘ | |
│ └───┘ └────────────────┘ │ │ │ | |
│ if [ "x" != "x"$i ]; then ◀────────────┐ │ └──┘ | |
│ │ │ ┌──────────────────────────────────────┐ | |
┌─────┼──────────┐target_day=$i └─────────┼───│ test passes when row is not blank │ | |
│ │ fi │ │ └──────────────────────────────────────┘ | |
│ │done │ │ | |
│ │ ┌────┐ ┌─────────────────┐ │ | |
│ │today=`│date│ | │awk '{print $3}' │` │ | |
│ │ └────┘ └─────────────────┘──────────────────┼────┐ | |
│ │if [ $target_day = $today ]; then │ │ | |
│ │ # run some script │ │ | |
print the │else │ │ | |
date & │ echo "No send content orders action performed, Not │ │ | |
time │last Thursday of the month yet!" │ │ | |
│ │fi │ │ | |
│ │exit │ │ | |
│ │ │ │ | |
│ └─────────────────────────────────────────────────────┘ │ | |
│ │ | |
┌──┐ ▼ │ | |
┌──────────┼──┼────────────────────┐ │ | |
│ Fri Jul │29│ 16:16:17 EDT 2016 │ │ | |
└──────────┼──┼────────────────────┘ │ | |
│ │ │ | |
└──┘ │ | |
▲ extract │ | |
└────────────────────────────this ────────────────────────────────────┘ | |
column |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment