-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathtest-linuxhint-list-bash-programming.sh
More file actions
42 lines (42 loc) · 1.09 KB
/
test-linuxhint-list-bash-programming.sh
File metadata and controls
42 lines (42 loc) · 1.09 KB
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
#!/bin/bash
## test-linuxhint-list-bash-programming
## version 0.0.1 - initial
##################################################
test-linuxhint-list-bash-programming() {
local url
local line
local title
local href
url="https://linuxhint.com/category/bash-programming/page/[1-99]/"
curl --silent --url "${url}" |
grep --line-number -e 'entry-title' | while read -r line
do
_() {
echo ${line} |
grep --only-matching -e "${1}=\"[^\"]*" |
cut '-d"' '-f2'
}
echo ${line} 1>&2
## setup
title=$( _ title )
href=$( _ href )
## guards
test "${title}" || continue
test "${href}" || continue
echo "+ [$( _ title )]($( _ href ))"
done | sort
}
##################################################
if [ ${#} -eq 0 ]
then
true
else
exit 1 # wrong args
fi
##################################################
test-linuxhint-list-bash-programming
##################################################
## generated by create-stub2.sh v0.1.2
## on Mon, 27 May 2019 20:22:43 +0900
## see <https://github.com/temptemp3/sh2>
##################################################