Browse Source

Add utility function to print horizontal "ruler"

Mostly for easier visual distinction and also for fun.
Alois Mahdal 5 years ago
parent
commit
cd90fa9d87
1 changed files with 17 additions and 0 deletions
  1. 17
    0
      dotfiles/bash/main.bashrc

+ 17
- 0
dotfiles/bash/main.bashrc View File

@@ -33,6 +33,23 @@ dT() {
33 33
     __bashum_run_n "${1:-1}" xfce4-terminal
34 34
 }
35 35
 
36
+hr() {
37
+    #
38
+    # Make horizontal ruler
39
+    #
40
+    local i
41
+    local line
42
+    for i in $(seq 1 "$COLUMNS"); do
43
+        case $((i%10)) in
44
+            0)  line+='#' ;;
45
+            *)  line+='-' ;;
46
+        esac
47
+    done
48
+    echo "$line"
49
+    echo "$line"
50
+    echo "$line"
51
+}
52
+
36 53
 __bashum_run_n() {
37 54
     #
38 55
     # Run $2 in background $1 times