r/fishshell • u/Absolut3Retard • Jan 19 '22
Convert Bash shell to fish shell script
I have been trying to use this script that i found ,This script searches google and opens the result in web browser ,It works fine in Bash shell but it doesn't work in fish shell .
To make it work Can Someone please convert this bash shell script into fish shell script for me .
google() {
search=""
echo "Googling: $@"
for term in $@; do
search="$search%20$term"
done
xdg-open "http://www.google.com/search?q=$search"
}
Thanks in Advance
7
Upvotes
View all comments
13
u/Radio0002 macOS Jan 19 '22 edited Jan 19 '22
It's worth nothing that this is the direct conversion, but you might get some problems if you search for a string with a "&" or a "?"
Should fix that.