2 added 1 character in body
source | link

First make a script doit.sh that takes two parameters: the keyword and the url:

#!/bin/bash
mkdir -p $1
cat > $1/$1.txt << EOF
#!/bin/bash
echo [\$@]
echo "command=xdg-open \\" $2 \$@\\""
echo "icon="
echo "subtext=Search on $1 for \$@"
EOF

make it executable (chmod +x doit.sh) and test it until calling it with two parameters gets you the right result. (mkdir's -p option prevents complaining that the directory already exists). Especially focus on escaping the $ and \ to be preserved in the output.

Once you have that, call the script for every line with two parameters:

awk -F "," '{print "./doit.sh " $1 " " $2}' web_url.csv  | sh

The way you have been doing it, you walk over all keyword (for word in $key) but you don't have the matching urlURL to do the proper thing.

I am not sure how to fix that, but if you need to do multiple things, always try to do one of those things correctly, then focus on how to use that solution multiple times. Being unfamiliar with awk I had to experiment without piping the output into sh until I could see the doit.sh would be called correctly:

awk -F "," '{print "./doit.sh " $1 " " $2}' web_url.csv  

gives as output:

./doit.sh drive http://www.drive.google.com/
./doit.sh wikipedia https://en.wikipedia.org/wiki/%s
./doit.sh wolframalpha http://www.wolframalpha.com/input/?i=%s

First make a script doit.sh that takes two parameters: the keyword and the url:

#!/bin/bash
mkdir -p $1
cat > $1/$1.txt << EOF
#!/bin/bash
echo [\$@]
echo "command=xdg-open \\" $2 \$@\\""
echo "icon="
echo "subtext=Search on $1 for \$@"
EOF

make it executable (chmod +x doit.sh) and test it until calling it with two parameters gets you the right result. (mkdir's -p option prevents complaining that the directory already exists. Especially focus on escaping the $ and \ to be preserved in the output.

Once you have that call the script for every line with two parameters:

awk -F "," '{print "./doit.sh " $1 " " $2}' web_url.csv  | sh

The way you have been doing it, you walk over all keyword (for word in $key) but you don't have the matching url to do the proper thing.

I am not sure how to fix that, but if you need to do multiple things, always try to do one of those things correctly, then focus on how to use that solution multiple times. Being unfamiliar with awk I had to experiment without piping the output into sh until I could see the doit.sh would be called correctly:

awk -F "," '{print "./doit.sh " $1 " " $2}' web_url.csv  

gives as output:

./doit.sh drive http://www.drive.google.com/
./doit.sh wikipedia https://en.wikipedia.org/wiki/%s
./doit.sh wolframalpha http://www.wolframalpha.com/input/?i=%s

First make a script doit.sh that takes two parameters: the keyword and the url:

#!/bin/bash
mkdir -p $1
cat > $1/$1.txt << EOF
#!/bin/bash
echo [\$@]
echo "command=xdg-open \\" $2 \$@\\""
echo "icon="
echo "subtext=Search on $1 for \$@"
EOF

make it executable (chmod +x doit.sh) and test it until calling it with two parameters gets you the right result. (mkdir's -p option prevents complaining that the directory already exists). Especially focus on escaping the $ and \ to be preserved in the output.

Once you have that, call the script for every line with two parameters:

awk -F "," '{print "./doit.sh " $1 " " $2}' web_url.csv  | sh

The way you have been doing it, you walk over all keyword (for word in $key) but you don't have the matching URL to do the proper thing.

I am not sure how to fix that, but if you need to do multiple things, always try to do one of those things correctly, then focus on how to use that solution multiple times. Being unfamiliar with awk I had to experiment without piping the output into sh until I could see the doit.sh would be called correctly:

awk -F "," '{print "./doit.sh " $1 " " $2}' web_url.csv  

gives as output:

./doit.sh drive http://www.drive.google.com/
./doit.sh wikipedia https://en.wikipedia.org/wiki/%s
./doit.sh wolframalpha http://www.wolframalpha.com/input/?i=%s
1
source | link

First make a script doit.sh that takes two parameters: the keyword and the url:

#!/bin/bash
mkdir -p $1
cat > $1/$1.txt << EOF
#!/bin/bash
echo [\$@]
echo "command=xdg-open \\" $2 \$@\\""
echo "icon="
echo "subtext=Search on $1 for \$@"
EOF

make it executable (chmod +x doit.sh) and test it until calling it with two parameters gets you the right result. (mkdir's -p option prevents complaining that the directory already exists. Especially focus on escaping the $ and \ to be preserved in the output.

Once you have that call the script for every line with two parameters:

awk -F "," '{print "./doit.sh " $1 " " $2}' web_url.csv  | sh

The way you have been doing it, you walk over all keyword (for word in $key) but you don't have the matching url to do the proper thing.

I am not sure how to fix that, but if you need to do multiple things, always try to do one of those things correctly, then focus on how to use that solution multiple times. Being unfamiliar with awk I had to experiment without piping the output into sh until I could see the doit.sh would be called correctly:

awk -F "," '{print "./doit.sh " $1 " " $2}' web_url.csv  

gives as output:

./doit.sh drive http://www.drive.google.com/
./doit.sh wikipedia https://en.wikipedia.org/wiki/%s
./doit.sh wolframalpha http://www.wolframalpha.com/input/?i=%s