-
Notifications
You must be signed in to change notification settings - Fork 0
/
about.sh
executable file
·105 lines (92 loc) · 2.59 KB
/
about.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
# AUTHER: magcho<[email protected]>
# REPOSITPRY: github.com/magcho/about
# This script is meant for show magcho's self-introduction via:
# $ curl -Ls about.magcho.com | sh
#
# NOTE: This script has subcommands via:
# $ curl -Ls about.magcho.com | sh -s (help|more|tw|hp)
Usage(){
echo "usage: curl -Ls about.magcho.com | sh
magcho's self-introduction
How to execute subcommands
e.g.) curl -Ls about.magcho.com | sh -s help
"
}
Help(){
echo "subcommands:
help Display the help message
more Display full the magcho's introduction
tw Visit to magcho's Twitter
hp Visit to magcho.com
gp Visit to magcho's GitHub page"
}
Intro(){
echo " | \033[32mName:\033[m magcho |
| \033[034mTwitter:\033[039m https://twitter.com/magcho0527 |
| \033[36mMail:\033[m [email protected] |
| \033[31mHP:\033[m https://magcho.com |"
}
IntroMore(){
if echo "$EDITOR" | grep 'emacs' > /dev/null; then
EDITOR_MESS=" (You'er emacser!! Let's be friends!) |"
elif echo "$EDITOR" | grep 'vim' > /dev/null; then
EDITOR_MESS=" (YOU ARE VIMMER??? SHALL WE USE EMACS?) |"
else
EDITOR_MESS=" (Shall we use Emacs?) |"
fi
BIRTHDAY_DATETIME=927730800 # 1999-05-27
A_YEAR_TIME=31557600 # 60*60*24*365.25
AGE=$((( $(date +%s) - BIRTHDAY_DATETIME) / A_YEAR_TIME))
echo " | Blog: https://blog.magcho.com |
| GitHub: https://github.com/magcho |
| Name: Suetake Dai |
| Age: $AGE |
| Job: WebFrontend Engineer |
| Keyboard: Lily58 |
| Main editor: Emacs |
|$EDITOR_MESS"
}
Open(){
if [ $1 = tw ]; then
echo 'open Twitter: https://twitter.com/magcho0527'
open https://twitter.com/magcho0527
elif [ $1 = hp ]; then
echo 'open HP: https://magcho.com'
open https://magcho.com
elif [ $1 = gh ]; then
echo 'open GitHub: https://github.com/magcho/'
open https://github.com/magcho/
fi
}
PrintLine(){
echo " ==============================================="
}
case $1 in
help)
Usage
Help
;;
more)
Usage
PrintLine
Intro
IntroMore
PrintLine
;;
tw)
Open tw
;;
hp)
Open hp
;;
gh)
Open gh
;;
*)
Usage
PrintLine
Intro
PrintLine
;;
esac