Over writing output to a text file
- by Naveen Gamage
I'm trying to write wget command's output to a text file, but it always appends to the text file.
#!/bin/sh
download()
{
local url=$1
echo -n " "
wget --progress=dot $url 2>&1 | grep --line-buffered "%" | \
sed -u -e "s,\.,,g" | awk '{printf("\b\b\b\b%4s", $2)}'
echo " DONE"
}
file="$1"
echo -n "Downloading $file:"
download "$file" > file.log
I tried using using > won't work, where am I doing wrong?