From bfa287b66ddd5282e1f778936d64cc8454794d19 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Fri, 6 Jun 2025 20:08:03 +0900 Subject: [bash,zsh] Separate common functions into "shell/common.sh" --- shell/update-common.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 shell/update-common.sh (limited to 'shell/update-common.sh') diff --git a/shell/update-common.sh b/shell/update-common.sh new file mode 100755 index 00000000..55905043 --- /dev/null +++ b/shell/update-common.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# This script applies the contents of "common.sh" to the other files. + +set -e + +# Go to the directory that contains this script +dir=${0%"${0##*/}"} +if [ -n "$dir" ]; then + cd "$dir" +fi + +update() { + { + sed -n '1,/^#----BEGIN INCLUDE common\.sh/p' "$1" + cat < "$1.part" + + mv -f "$1.part" "$1" +} + +update completion.bash +update completion.zsh +update key-bindings.bash +update key-bindings.zsh -- cgit v1.2.3