tianyunperfect 1 year ago
parent
commit
8ab0770ec1
2 changed files with 4 additions and 3 deletions
  1. 1 1
      sh_config.sh
  2. 3 2
      tmp.sh

+ 1 - 1
sh_config.sh

@@ -226,7 +226,7 @@ concat_params() {
     # 使用循环遍历参数,并拼接在一起
     # 使用循环遍历参数,并拼接在一起
     concat_str="$1"
     concat_str="$1"
     for ((i=2; i<=$num_params; i++)); do
     for ((i=2; i<=$num_params; i++)); do
-      concat_str+="%20$i"
+      concat_str+="%20${!i}"
     done
     done
 
 
     # 打印拼接后的字符串
     # 打印拼接后的字符串

+ 3 - 2
tmp.sh

@@ -7,7 +7,7 @@ concat_params() {
     # 使用循环遍历参数,并拼接在一起
     # 使用循环遍历参数,并拼接在一起
     concat_str="$1"
     concat_str="$1"
     for ((i=2; i<=$num_params; i++)); do
     for ((i=2; i<=$num_params; i++)); do
-      concat_str+="%20$i"
+      concat_str+="%20${!i}"
     done
     done
 
 
     # 打印拼接后的字符串
     # 打印拼接后的字符串
@@ -20,6 +20,7 @@ concat_params() {
 function bing() {
 function bing() {
   # 获取拼接后的搜索参数
   # 获取拼接后的搜索参数
   search_query=$(concat_params "$@")
   search_query=$(concat_params "$@")
+#   echo $search_query
 
 
   ## 如果是windows系统,则使用start,否则使用open,后面的参数可以有多个空格
   ## 如果是windows系统,则使用start,否则使用open,后面的参数可以有多个空格
   if [[ "$OSTYPE" == "msys"* ]]; then
   if [[ "$OSTYPE" == "msys"* ]]; then
@@ -28,4 +29,4 @@ function bing() {
     open "https://www.bing.com/search?q=$search_query"
     open "https://www.bing.com/search?q=$search_query"
   fi
   fi
 }
 }
-bing 1 2 3 4 5 6 7 8 9 10
+bing bat cat 对比