#!/bin/bash # Noninteractive use of 'vi' to edit a file. # Emulates 'sed'. E_BADARGS=85 if [ -z "$1" ] then echo "Usage: `basename $0` filename" exit $E_BADARGS fi TARGETFILE=$1 # Insert 2 lines in file, then save. #--------Begin here document-----------# vi $TARGETFILE <. # Bram Moolenaar points out that this may not work with 'vim' #+ because of possible problems with terminal interaction. exit