I want to write a command with removes an item from a file .todolist
like that:
path="$HOME/.todolist"
if [ "$task" == "- " ];
then
exit 1
fi
cat $path | grep -v $1 > $path
When I cat $path | grep -v $1
all works perfect but when I try writing back to the file it leaves the file empty. What am I doing wrong?