Browse Source

Pass $Url to dissect(), in line with Shellfu coding style

Alois Mahdal 6 years ago
parent
commit
a5ada53506
1 changed files with 10 additions and 7 deletions
  1. 10
    7
      bin/dissect_url

+ 10
- 7
bin/dissect_url View File

@@ -1,7 +1,10 @@
1 1
 #!/bin/bash
2 2
 
3 3
 dissect() {
4
-    echo $* | perl -pe '
4
+    #
5
+    # Print "dissected" version of $Url
6
+    #
7
+    echo "$Url" | perl -pe '
5 8
         s|(\w)(/[^/])|$1\n    $2|;
6 9
         s|\?|\n    ?\n        |;
7 10
         s|#|\n    #\n        |;
@@ -10,18 +13,18 @@ dissect() {
10 13
 }
11 14
 
12 15
 main() {
13
-    local url=$1
16
+    local Url=$1
14 17
     local i=0
15
-    if [[ -n "$url" ]]; then
16
-        dissect "$url"
18
+    if [[ -n "$Url" ]]; then
19
+        dissect
17 20
     else
18 21
         i=0
19
-        while read -r url;
22
+        while read -r Url;
20 23
         do
21
-            if [[ -z "$url" ]]; then exit 0; fi
24
+            if [[ -z "$Url" ]]; then exit 0; fi
22 25
             ((i++))
23 26
             printf '=== url %02d =============================================\n' $i
24
-            dissect "$url"
27
+            dissect
25 28
         done
26 29
     fi
27 30
 }