#!/bin/sh
FILENAME=file.txt # 可换为$1
if [ ! -f file.txt ];then
echo "$FILENAME no found"
exit 1
fi
echo -n "INPUT SOME THING: "
read
if [ ! -z ”$REPLY“ ];then
INFO=$(grep $REPLY FILENAME)
if [ ! -z "$INFO" ] ; then
sed -i -e '/$REPLY/d' FILENAME #删除只用这行就可以了
else
echo "没有指定内容的信息"
exit 1
fi
else
echo "input some thing"
exit 1
fi
exit $?
sed '/yourstring/'d yourfile