-
-
Save mostafar/116a0cb79005955476b24c0960b72d5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IFS=$'\n\t' | |
set -euox pipefail | |
CNAME="$1" | |
FILE_PATH="$2" | |
FILE_NAME="$(basename "$FILE_PATH")" | |
TMPFILE="$(mktemp --suffix=_$FILE_NAME)" | |
docker exec "$CNAME" cat "$FILE_PATH" > "$TMPFILE" | |
$EDITOR "$TMPFILE" | |
cat "$TMPFILE" | docker exec -i "$CNAME" sh -c 'cat > '"$FILE_PATH" | |
rm "$TMPFILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment