Skip to content

Instantly share code, notes, and snippets.

@nenadg
Forked from dmohs/dedit.sh
Created December 26, 2016 14:59
Show Gist options
  • Save nenadg/6e8d4a90ef882dafab797eef189b88b9 to your computer and use it in GitHub Desktop.
Save nenadg/6e8d4a90ef882dafab797eef189b88b9 to your computer and use it in GitHub Desktop.
#!/bin/bash
IFS=$'\n\t'
set -euox pipefail
CNAME="$1"
FILE_PATH="$2"
TMPFILE="$(mktemp)"
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