[Shell]一个笨笨的echo进度条 :)

发表于:2007-05-26来源:作者:点击数: 标签:
SecureCRT终端下可能显示效果不好,其它终端正常~ #!/bin/sh for i in `seq 1 100`; do arrow=$arrow= echo -e -n \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b

SecureCRT终端下可能显示效果不好,其它终端正常~

#!/bin/sh
for i in `seq 1 100`; do
        arrow="$arrow="
        echo -e -n "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
        if [ $i -le 25 ]
        then
                disp="i<=25%    "
        elif [ $i -le 50 ]
        then
                disp="25%        elif [ $i -le 75 ]
        then
                disp="50%        elif [ $i -le 99 ]
        then
                disp="i>75%     "
        else [ $i -eq 100 ]
                disp="i=100%    "
                enter=" OK!\n"
        fi
        echo -e -n "Loading[$]:$>$%$"
        sleep 0.1
done

NAME
       echo - display a line of text

SYNOPSIS
       echo [OPTION]... [STRING]...

DESCRIPTION
       NOTE:  your shell may have its own version of echo which will supercede
       the version described here. Please refer to your shell鈥檚  documentation
       for details about the options it supports.

       Echo the STRING(s) to standard output.

       -n     do not output the trailing newline

       -e     enable interpretation of the backslash-escaped characters listed
              below

       -E     disable interpretation of those sequences in STRINGs

       --help display this help and exit

       --version
              output version information and exit

       Without -E, the following sequences are recognized and interpolated:

       \NNN   the character whose ASCII code is NNN (octal)
NAME
       echo - display a line of text

SYNOPSIS
       echo [OPTION]... [STRING]...

DESCRIPTION
       NOTE:  your shell may have its own version of echo which will supercede
       the version described here. Please refer to your shell鈥檚  documentation
       for details about the options it supports.

       Echo the STRING(s) to standard output.

       -n     do not output the trailing newline

       -e     enable interpretation of the backslash-escaped characters listed
              below

       -E     disable interpretation of those sequences in STRINGs

       --help display this help and exit

       --version
              output version information and exit

       Without -E, the following sequences are recognized and interpolated:

       \NNN   the character whose ASCII code is NNN (octal)

       \     backslash

       \a     alert (BEL)

       \b     backspace

       \c     suppress trailing newline

       \f     form feed

       \n     new line

       \r     carriage return

       \t     horizontal tab

       \v     vertical tab

原文转自:http://www.ltesting.net