Skip to content

Instantly share code, notes, and snippets.

@deanturpin
Last active June 14, 2019 08:57
Show Gist options
  • Save deanturpin/22ea3011851c2a0a3144ed9be814d080 to your computer and use it in GitHub Desktop.
Save deanturpin/22ea3011851c2a0a3144ed9be814d080 to your computer and use it in GitHub Desktop.
Ways to chomp a newline in bash
head -c -1
tr "\n" " "
echo -n $(<command>)
xargs echo -n
[[ $(<command>) =~ <regex> ]] && echo -n $BASH_REMATCH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment