Przeglądaj źródła

Use seperate search and encode functions instead

master
= 4 lat temu
rodzic
commit
d0f61568eb
1 zmienionych plików z 8 dodań i 9 usunięć
  1. +8
    -9
      prompt

+ 8
- 9
prompt Wyświetl plik

@@ -78,23 +78,22 @@ both" |


ddg() { ddg() {
search_string="$(printf "" | dmenu -p 'ddg')" search_string="$(printf "" | dmenu -p 'ddg')"
rawurlencode "$search_string" string_length=$(expr length "$search_string")
}

rawurlencode() {
string_length=$(expr length $1)
char=''; new_string=''; char=''; new_string='';


i=1 i=1
while [ $i -le $string_length ] while [ $i -le $string_length ]
do do
char=$(expr substr $search_string $i 1) char=$(expr substr "$search_string" $i 1)
new_string=$new_string$(rawurlencode $char) new_string="$new_string$(rawurlencode "$char")"
printf "this is newstring %s\n" $new_string # printf "this is newstring %s\n" "$new_string"
i=$(expr $i + 1) i=$(expr $i + 1)
done done
printf "$newstring\n" search="https://duckduckgo.com/?q=$new_string"
brave-browser "$search"
}


rawurlencode() {
case "$1" in case "$1" in
[-_.~a-zA-Z0-9] ) result=$1; printf $result;; [-_.~a-zA-Z0-9] ) result=$1; printf $result;;
* ) result=$(printf '%%%02x' "'$1"); printf %$result;; * ) result=$(printf '%%%02x' "'$1"); printf %$result;;


||||||
x
 
000:0
Ładowanie…
Anuluj
Zapisz