Skip to content

Instantly share code, notes, and snippets.

@tonejito
Last active September 29, 2022 00:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonejito/2c93eb0d55fbfb06470933f03aaff055 to your computer and use it in GitHub Desktop.
Save tonejito/2c93eb0d55fbfb06470933f03aaff055 to your computer and use it in GitHub Desktop.
Full width separator with Perl or (bash) shell magic
SHELL=/bin/bash
# = ^ . ^ =
SEP?=-
COLS=$(shell tput cols)
.PHONY: separator test
test:
@$(MAKE) -s separator
@$(MAKE) -s separator SEP=#
@SEP=_ $(MAKE) -s separator
@SEP== $(MAKE) -s separator
@SEP=+ make -s separator SEP=*
separator:
@(which perl &>/dev/null && perl -e 'print("${SEP}" x ${COLS} . "\n")' || for i in {1..${COLS}} ; do printf '${SEP}' ; done ; echo '')
@tonejito
Copy link
Author

tonejito commented Dec 16, 2019

$ make separator
-----------------------------------------------------------------------------------------------------------------------

$ make separator SEP=#
#######################################################################################################################

$ SEP=_ make separator
_______________________________________________________________________________________________________________________

$ SEP== make separator
=======================================================================================================================

$ SEP=+ make separator SEP=*
***********************************************************************************************************************

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment