Skip to content

Instantly share code, notes, and snippets.

@hackugyo
Last active November 6, 2015 05:05
Show Gist options
  • Select an option

  • Save hackugyo/0aa835bdd33ec1ba5118 to your computer and use it in GitHub Desktop.

Select an option

Save hackugyo/0aa835bdd33ec1ba5118 to your computer and use it in GitHub Desktop.
Google:未指定キーワードを発生させずに検索する
# usage:
# $ gsearch your query
# => Google '"your" "query"'
gsearch ()
{
( argv=("$@");
# arr=$(for v in "${argv[@]}"; do echo "$v"; done); \
arr=$(for v in "${argv[@]}"; do echo "\"$v\""; done);
str="$(IFS=" "; echo "${arr[*]}")";
open https://www.google.co.jp/search?q="$str" )
# サブシェルを使う(カッコで全体を囲む)ことでbashrcに記述しても変数を汚さないようにしてある
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment