Skip to content

Commit 8a0aa9a

Browse files
committed
use bash function syntax
1 parent 29aff73 commit 8a0aa9a

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

bin/mirror_with_wget.sh

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ set -o errtrace
33
set -o nounset
44

55

6-
BASE="${0%/*}"
6+
function _change_to_repo_dir {
7+
cd "${0%/*}/.." >/dev/null
8+
}
79

810

9-
_mirror(){
11+
function _mirror {
1012
# Note: the --mirror option is equivalent to:
1113
# --recursive
1214
# --timestamping
@@ -38,31 +40,31 @@ prep() {
3840
}
3941

4042

41-
_2017_root() {
43+
function _2017_root {
4244
printf "\e[1m\e[7m %-80s\e[0m\n" 'Mirroring 2017 State of the Commons'
4345
# Mirror
4446
_mirror /
4547
echo
4648
}
4749

4850

49-
_2016_subdir() {
51+
function _2016_subdir {
5052
printf "\e[1m\e[7m %-80s\e[0m\n" 'Mirroring 2016 State of the Commons'
5153
# Mirror
5254
_mirror /2016/
5355
echo
5456
}
5557

5658

57-
_2015_subdir() {
59+
function _2015_subdir {
5860
printf "\e[1m\e[7m %-80s\e[0m\n" 'Mirroring 2015 State of the Commons'
5961
# Mirror
6062
_mirror /2015/
6163
echo
6264
}
6365

6466

65-
_cleanup() {
67+
function _cleanup {
6668
printf "\e[1m\e[7m %-80s\e[0m\n" 'Performing clean-up on mirror'
6769
if [[ -d stateof.creativecommons.org ]]
6870
then
@@ -78,8 +80,7 @@ _cleanup() {
7880
}
7981

8082

81-
cd "${BASE}/.." >/dev/null
82-
83+
_change_to_repo_dir # must be called first
8384
_prep
8485
_2017_root
8586
_2016_subdir

0 commit comments

Comments
 (0)