Help with shell programming
Hello all,
I have a shell script where User types in a searchphrase ./test -s "Classical Music".....the script then passes the string to google using wget and stores the received file. After this it runs through the sed program several times to remove any unwanted materials from the file and to prepare it in correct format.....and eventually output the contents of the file into the screen in either plaintext or htmltable. here is my script: Code:
wget -t1 -E -e robots=off - -awGet.log -T 200 -H -Priserless -O mylist1.html -U "Mozilla" "http://www.google.co.uk/search?q=classical+music&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-GB:unofficial&client=firefox-a" Thanks in advance. |
Hi kilo_911,
I don't really get your question..... if your question is how to get the argument from your command line it's simple, use ${1} for the first argument, ${2} for the second and so one. the ${0} will retrieve the command name. Note: I've remove the "-s" as I didn't know what do you wanted to do with it. (the simple the better :)) Ex: ./test "Classical Music" Code:
#!/bin/bash Angel. |
Quote:
You are close enough as to what I am looking for...... What I want is say is the user types in ./test -s "Classical Music", which passes this string to google using the 'wget' in my script to lookup google and then store all the information into the files 'mylist.html' which I have in myscript and run through 'sed' program by removing the superfluous materianls, finally displaying it on the terminal where the user passes the argument in either plaintext or html! Thanks |
Hi kilo_911,
Cool, happy to hear that; just one thing if I may comment. you should drop the "-s" as it doesn't add any value to your script. After several years of scripting I learn something: ##### The simpler the better. ##### So keep it simple and you will keep you self away from troubles. ;) Angel. |
All times are GMT -5. The time now is 11:35 AM. |