aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-07-22 06:15:01 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-07-22 06:15:01 +0300
commite8b85196ca58a0b6c6a3c9cf607f7894c23265b7 (patch)
treee55b4d4374156b42a447287b53fda101b561bc7e
parentadd slice_pgn_moves, normalize_pgn (diff)
downloadlinux-home-e8b85196ca58a0b6c6a3c9cf607f7894c23265b7.tar.gz
linux-home-e8b85196ca58a0b6c6a3c9cf607f7894c23265b7.zip
add append_pgn, join_pgns
Diffstat (limited to '')
-rw-r--r--.bashrc24
1 files changed, 24 insertions, 0 deletions
diff --git a/.bashrc b/.bashrc
index c92e51b..ed8825a 100644
--- a/.bashrc
+++ b/.bashrc
@@ -357,3 +357,27 @@ normalize_pgn() {
&& slice_pgn_moves "$@" \
&& eol2dos "$@"
}
+
+append_pgn() {
+ if [ "$#" -ne 2 ]; then
+ echo "$FUNCNAME: usage: $FUNCNAME DEST_PGN SRC_PGN" >&2
+ return 1
+ fi
+
+ printf '\r\n' >> "$1" \
+ && cat "$2" >> "$1"
+}
+
+join_pgns() (
+ [ "$#" -eq 0 ] && return
+
+ set -o errexit
+
+ cat "$1"
+
+ local i
+ for i in "${@:2}"; do
+ printf '\r\n'
+ cat "$i"
+ done
+)