Bash function that removes whitespace and newline character from a string of text.
#!/usr/bin/env bash
##
# Removes whitespace and newline characters
#
# Examples:
#
# $ strip "some words with spaces"
# somewordswithspaces
#
# $ echo "some words with spaces" | strip
# somewordswithspaces
##
strip() {
local arg
if [[ -z $1 ]]; then
read -r arg
else
arg=$1
fi
echo "$arg" | tr -d ' \r\n\t'
}