From: srikanth on 15 Jun 2010 00:09 On Jun 14, 9:20 pm, John Kelly <j...(a)isp2dial.com> wrote: > On Mon, 14 Jun 2010 08:34:47 -0700 (PDT), srikanth > > > > <srikanth0...(a)gmail.com> wrote: > >Hi All, > >I need to browse some URLs in browser. Here I am having 600+ URLs to > >browse. I have written a shell script to do this but the script is not > >working properly. Here is my script. > > >#!/bin/bash > >if [ -z "$1" ] > >then > > printf "Provide input text file to process the URLs\n" > > exit 0 > >fi > >{ > > for i in `cat $1` > > do > > echo "`xdg-open $i`" > > done > >} > >exit 0 > > a for loop is OK with a small number of elements, but when the data set > is large, a while read loop is better. > > while read; do > xdg-open "$REPLY" > done <$1 > > > > >Here i am using xdg-open because it will open user set default > >browser. > >How can i open each URL one by one on same window? or tab. instead of > >killing the browser and relaunching it. > > I don't think you can from a shell script. > > >Even though it is fine like browsing one url and kill that browser > >and relaunch it and browse next > > -- > Web mail, POP3, and SMTPhttp://www.beewyz.com/freeaccounts.php Is there a way to kill the browser after each iteration?
From: Ben Finney on 15 Jun 2010 00:13 srikanth <srikanth007m(a)gmail.com> writes: > On Jun 14, 9:20 pm, John Kelly <j...(a)isp2dial.com> wrote: > > while read; do > > xdg-open "$REPLY" > > done <$1 > John, > Here "$REPLY" means what? It means “current value of the REPLY variable”. The double quotes instruct the shell not to perform word splitting and glob expansion. -- \ “I believe our future depends powerfully on how well we | `\ understand this cosmos, in which we float like a mote of dust | _o__) in the morning sky.” —Carl Sagan, _Cosmos_, 1980 | Ben Finney
From: Bit Twister on 15 Jun 2010 00:48 On Mon, 14 Jun 2010 21:09:24 -0700 (PDT), srikanth wrote: > Is there a way to kill the browser after each iteration? Put the browser in the background and use pkill to kill the browser. while read -r url ; do xdg-open "url" & sleep 2 pkill $USER xdg-open done <$1
From: Chris Nehren on 15 Jun 2010 02:20 On 2010-06-14, John Kelly scribbled these curious markings: > On Mon, 14 Jun 2010 08:34:47 -0700 (PDT), srikanth > <srikanth007m(a)gmail.com> wrote: >>How can i open each URL one by one on same window? or tab. instead of >>killing the browser and relaunching it. > > I don't think you can from a shell script. Indeed. The "open in new {window,tab}" functionality is dependent upon the user's DE configuration, and only certain browsers are supported. Some browsers can be configured to open URLs from external programs in either new tabs or new windows, too. This is not something you can control from the xdg-open utility, as it knows nothing about the actual browser or its capabilities. -- Thanks and best regards, Chris Nehren
From: John Kelly on 15 Jun 2010 07:42
On Tue, 15 Jun 2010 14:13:27 +1000, Ben Finney <ben+unix(a)benfinney.id.au> wrote: >srikanth <srikanth007m(a)gmail.com> writes: > >> On Jun 14, 9:20�pm, John Kelly <j...(a)isp2dial.com> wrote: >> > while read; do >> > � � xdg-open "$REPLY" >> > done <$1 >> John, >> Here "$REPLY" means what? > >It means �current value of the REPLY variable�. The double quotes >instruct the shell not to perform word splitting and glob expansion. The "while read" loop reads the file line by line, and puts one line at a time into $REPLY. You can write a while read loop to use a different variable name, but $REPLY is the default variable name. -- Web mail, POP3, and SMTP http://www.beewyz.com/freeaccounts.php |