如何快速搜索?

脚本如下

#!/usr/bin/env bash
[[ -n $DEBUG ]] && set -x
set -eou pipefail

useage(){
    cat <<"EOF"
USAGE:
    open.sh OPENPATH
EOF
}

exit_err() {
    echo >&2 "${1}"
    exit 1
}

if [ $# -lt 1 ];then
    useage
    exit
fi

OPENPATH=$1

if [ -f "${OPENPATH}" ];then
    while read -r LINE;do
        xdg-open "$LINE">/dev/null 2>&1
    done < "${OPENPATH}"
else
    xdg-open "${OPENPATH}" >/dev/null 2>&1
fi
#!/usr/bin/env bash
[[ -n $DEBUG ]] && set -x
set -eou pipefail

useage(){
    cat <<"EOF"
USAGE:
    wtf.sh SOMETHING
EOF
}

exit_err() {
    echo >&2 "${1}"
    exit 1
}

if [ $# -lt 1 ];then
    useage
    exit
fi

urlEncode() {
    echo |tr -d '\n'|od -An -tx1|tr ' ' %
}

SOMETHING=$(echo "$@"|tr -d '\n'|od -An -tx1|tr ' ' %)
open "https://www.google.com/search?q=${SOMETHING}"
open "https://www.baidu.com/s?wd=${SOMETHING}"
open "https://github.com/search?q=${SOMETHING}"
open "https://stackoverflow.com/search?q=${SOMETHING}"
open "https://medium.com/search?q=${SOMETHING}"
open "http://s.weibo.com/weibo/${SOMETHING}"
open "https://weixin.sogou.com/weixin?type=2&query=${SOMETHING}"
open "https://www.youtube.com/results?search_query=${SOMETHING}"
open "https://search.bilibili.com/all?keyword=${SOMETHING}"

使用方法

# nginx报错499
wtf nginx 499
posted @ 2019-12-17 13:23  futuretea  阅读(222)  评论(0编辑  收藏  举报