Can echo overwrite the previous line?

Anderson Lizardo andersonlizardo at yahoo.com.br
Sun Nov 30 06:36:12 MST 2003


DJ Lucas wrote:
> # echo -en "foo" \\\r && sleep 1 && echo "bar"

You can simplify it by using single quotes:

echo -en 'foo\r' && sleep 1 && echo "bar"

>
> or better for my purpose....
>
> # echo -en "foo"
> # if [ -z whatever ]
> # then echo -en \\\r "bar"
> # else
> # echo ""
> # echo "next line"

You can also use this code (based on code from lfs-bootscripts):

echo "foo"
[ -z "$var" ] && echo -e \\033[A"bar"
echo "next line"

-- 
Anderson Lizardo




More information about the lfs-chat mailing list