Skip to content

Instantly share code, notes, and snippets.

@Artoria2e5
Forked from 1a57danc3/FBI WARNING SSH NOTIFICATION.SH
Last active November 12, 2015 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Artoria2e5/b4cd6e06dfa1b565b27c to your computer and use it in GitHub Desktop.
Save Artoria2e5/b4cd6e06dfa1b565b27c to your computer and use it in GitHub Desktop.
fbi_warning_rc.bash
#!/bin/bash
# Add this to your bashrc. May work in other shells.
# For POSIX Portability, apply github.com/koalaman/shellcheck/wiki/SC2039
# Find out current screen width, if COLUMNS is absent
[ "$COLUMNS" ] || COLUMNS=$(tput cols || echo 80) _fbi_resetcol=1
_FBI_MESSAGE="Federal Law provides severe civil and criminal penalties \
for the unauthorized reproduction, distribution, or exhibition of \
copyrighted motion pictures (Title 17, United States Code, Sections \
501 and 508). The Federal Bureau of Investigation investigates \
allegations of criminal copyright infringement"
# Calculate x and y coordinates so that we can display $MESSAGE
# centered in the screen
_FBI_LINEBUF=" FBI Warning "
((_fbi_space = (COLUMNS-${#_FBI_LINEBUF}) / 2))
echo
printf "%-${_fbi_space}s%b" '' '\033[41;37;5m'"$_FBI_LINEBUF"'\033[0m'
_FBI_
# display the whole thing centered
_FBI_LINEBUF="(Title 17, United States Code, Section 506)."
((_fbi_space = (COLUMNS-${#_FBI_LINEBUF}) / 2 ))
printf "%-${_fbi_space}s%s" '' "$_FBI_LINEBUF"
echo " "
((_fbi_resetcol)) && unset COLUMNS
unset _FBI_LINEBUF _fbi_space _fbi_resetcol _
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment