how to use bash parameter ?It's a good example

testfunc2 ()
{
    echo "$# parameters";
    echo Using '$*';
    for p in $*;
    do
        echo "[$p]";
    done;
    echo Using '"$*"';
    for p in "$*";
    do
        echo "[$p]";
    done;
    echo Using '$@';
    for p in $@;
    do
        echo "[$p]";
    done;
    echo Using '"$@"';
    for p in "$@";
    do
        echo "[$p]";
    done
}

当然使用$1 $2 之类的,shift使用还没碰到,再说吧

然后我可以在终端是指./.bashrc文件

 

 

#search function
function google()
{
    w3m www.google.com/search?q="$*"
}
function baidu()
{
        w3m www.baidu.com/s?wd="$*"
}

 

It's very nice

posted @ 2012-06-15 16:28  Epirus  阅读(181)  评论(0编辑  收藏  举报