summaryrefslogtreecommitdiff
path: root/scripts/.scripts/centered
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2021-10-09 22:20:41 +0100
committerdavidovski <david@davidovski.xyz>2021-10-09 22:20:41 +0100
commit01ced0b7ce47d279789efb2dc70d1cd009ac56ad (patch)
tree6ece604b8ae3476d2d70c9c9d42f86fe607990da /scripts/.scripts/centered
initial commit
Diffstat (limited to 'scripts/.scripts/centered')
-rwxr-xr-xscripts/.scripts/centered17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/.scripts/centered b/scripts/.scripts/centered
new file mode 100755
index 0000000..a663336
--- /dev/null
+++ b/scripts/.scripts/centered
@@ -0,0 +1,17 @@
+#!/bin/sh
+read title
+clear
+columns=$(tput cols)
+rows=$(tput lines)
+tput clear
+y=$((($columns-$(echo -n $title | head -1 | wc -c))/2))
+x=$((($rows-$(echo $title | wc -l))/2))
+
+while read p; do
+ tput cup $x $y
+ echo "$p"
+ x=$((x+1))
+
+done <<< "$title";
+
+tput cup $rows 0