aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.bashrc_text
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-07-26 02:10:27 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-07-26 02:10:27 +0300
commit4042abe156b4f9cad30d66238b52fcd938043ded (patch)
treeb351938efa93930aed703119e28c9c269516121f /.bashrc_text
parentadd append_pgn, join_pgns (diff)
downloadlinux-home-4042abe156b4f9cad30d66238b52fcd938043ded.tar.gz
linux-home-4042abe156b4f9cad30d66238b52fcd938043ded.zip
split .bashrc into multiple files
Diffstat (limited to '')
-rw-r--r--.bashrc_text25
1 files changed, 25 insertions, 0 deletions
diff --git a/.bashrc_text b/.bashrc_text
new file mode 100644
index 0000000..2c25ff3
--- /dev/null
+++ b/.bashrc_text
@@ -0,0 +1,25 @@
+[ ! -z "${BASHRC_TEXT+x}" ] && return || readonly BASHRC_TEXT=1
+
+# Handy sed one-liners
+# --------------------
+
+alias dos2eol='sed --binary --in-place '"'"'s/\(\r\?\)$//'"'"
+alias eol2dos='sed --binary --in-place '"'"'s/\r\?$/\r/'"'"
+
+alias trim='sed --binary --in-place '"'"'s/[[:blank:]]*\(\r\?\)$/\1/'"'"
+
+alias trimeol='sed --binary --in-place -e :a -e '"'"'/^\n*$/{$d;N;ba}'"'"
+alias trimdoseol='sed --binary --in-place -e :a -e '"'"'/^\(\r\n\)*\r$/{$d;N;ba}'"'"
+
+alias eol='sed --binary --in-place '"'"'$a\'"'"
+alias doseol='sed --binary --in-place '"'"'$s/\r\?$/\r/;a\'"'"
+
+alias trimbom='sed --binary --in-place '"'"'1 s/^\xef\xbb\xbf//'"'"
+
+lint() {
+ trim "$@" && trimeol "$@" && eol "$@"
+}
+
+doslint() {
+ trim "$@" && trimdoseol "$@" && doseol "$@"
+}