Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # $(1) = title; $(2) = color; $(3) = left, center, right
- define draw_line
- @ \
- printf '%.0s-' {1..$(shell tput cols)}; \
- if test "$(1)"; then \
- cols=$(shell tput cols); \
- length=$(shell echo $(1) | awk '{print length}'); \
- case "$(3)" in \
- *right) let indent="length + 1" ;; \
- *center) let indent="cols - (cols - length) / 2" ;; \
- *left|*) let indent="cols" ;; \
- esac; \
- tput cub $$indent; \
- test "$(2)" && printf $$(tput setaf $(2)); \
- printf '$(1)'; \
- test "$(2)" && printf $$(tput sgr0); \
- fi; \
- echo
- endef
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement