Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 23 lines (18 sloc) 428 Bytes
#!/bin/bash
#
# Load a file with a lens
# using Augeas
#
FILE="$1"
LENS="$2"
shift 2
[[ -z $LENS || "x$1" = "x-h" || "x$1" = "x--help" ]] \
&& echo "Usage: $0 <file> <lens> [<cmd>[\n<cmd>]*]" \
&& exit 1
cat <<EOF | augtool --noautoload -i -r $(dirname $FILE)
set /augeas/load/$LENS/lens "$LENS.lns"
set /augeas/load/$LENS/incl "$(basename $FILE)"
set /augeas/context "/files/$(basename $FILE)"
load
$(echo -e $@)
EOF