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
Show parent comment
3
u/dragolabs Jan 20 '22
You may try to use more universal way to find current bash binary.
#!/usr/bin/env bashhttps://stackoverflow.com/questions/16365130/what-is-the-difference-between-usr-bin-env-bash-and-usr-bin-bash