Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firefox opening links ... 2

Status
Not open for further replies.

dbeez

Technical User
Aug 15, 2005
71
KR
I'm trying to feed a number of links into the firefox browser and have them all open up as different tags, rather than different processes.

Is this possible ??

At the moment I can't seem to open up even one link in firefox
Code:
firefox < [URL unfurl="true"]www.website.com[/URL]

I've had a look at the man page and it doesn't seem to suggest anything about doing this, which seems kinda strange.
 
thanks feherke,

I'm having a bit of a 'double quotes inside a double quotes' problem though. This is my code
Code:
find . -type f | while read f
do
if grep -q 'string' "$f"
then echo "$f" >> file.links && firefox -remote "openURL("$f",new-tab)"
else continue
fi
done
... now I realize that this is probably a case for xargs and find -print0, but I can't seem to implement them.

... how do I get bash to parse a variable inside double-quotes ??
 
Hi

Escape it with backslash ( / ) ?
Code:
firefox -remote "openURL([red]\[/red]"$f[red]\[/red]",new-tab)"
But why the double quotes around the $f anyway ?
Note, that for a web browser the default protocol is so if you want to open a local file, you should specify file:// explicitely.

Feherke.
 
you need double-quotes in case your URL [$f] has IFS [' ' - space by default.
I think using single-quotes ['$f'] in this instance will work as well.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Hi

I tried it, no need for quotes. This works :
Code:
[blue]master #[/blue] cat > "file with spaces in name" <<EOF
[blue]>[/blue] <html>
[blue]>[/blue] <body>
[blue]>[/blue] Open sesame
[blue]>[/blue] </body>
[blue]>[/blue] </html> 
[blue]>[/blue] EOF

[blue]master #[/blue] mozilla -remote "openFile(file:///home/master/file with spaces in name,new-tab)"
[tt]IFS[/tt] and/or quotes have no meaning there, that string is parsed by Mozilla.

Feherke.
 
ineteresting.
Could you try one more thing - I'm just curious.
Could you create a file with a comma [,] in its name?

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Ok thanks guys, just one more question
Code:
find . -type f | while read f
do
if grep -q 'university' "$f"
then echo "$f" > file.links && sed 's_^./_[URL unfurl="true"]http://_'[/URL] "$f" && firefox -remote "openURL(\"$f\",new_tab)
else continue
fi
done
I want to sed my file.links so that they give me properly formed URLs.

How do I do this without messing everything up ??
 
Hi

How cool ! Works for this two files too.
Code:
-rw-r--r--    1 master  users          41 2005-11-09 17:18 one, comma
-rw-r--r--    1 master  users          41 2005-11-09 17:19 one, or more, comma

Feherke.
 
feherke,
very interesting indeed although I don't understand how it's been done.

thanks.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
I want to sed my file.links so that they give me properly formed URLs.
Something like this ?
find . -type f | while read f
do grep -q 'university' "$f" && echo "$f" | sed 's_^\./_done > file.links

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi

vlad said:
I don't understand how it's been done.
Why ? The "new_tab" is a constant defined by them. First, if that string is found at the end of argument list, it is choped with the preceding comma. Then the resulted string is considered to be the URL.

Feherke.
 
Thanks phv,

that's kinda like it but I actually want my sed command to just take in a "$f" and then modify it and pass it along to the firefox -remote command to open it in my browser.

I'm parsing a load of files (webpages) on my computer, and if those pages have the keyword in them (in this case university), then I want each of them to open seperate tabs in my browser. And perhaps to be stored in a .links file at the same time ...

thanks again
 
feherke said:
Why ? The "new_tab" is a constant defined by them. First, if that string is found at the end of argument list, it is choped with the preceding comma. Then the resulted string is considered to be the URL.

Because usually the parameters to a function call are positional with the comma as a separator. Having comma in the name of the file should really screw-up the parameter positions [i.e. the signature of the function].

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Hi

Yes, that in case of functions in programming languages. But I think that [tt]openURL[/tt] thing is just a plain string which only looks like function calls in most programming languages.

Feherke.
 
hi guys ... this is the last piece of the puzzle ???

anyone got any ideas ???? then I'll buzz off ... promise ! <fingers crossed> :)

thanks
 
feherke,
looks like it - those pesky Mozillians.

thanks

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
find . -type f | while read f
do grep -q 'university' "$f" && echo "$f" | sed 's_^\./_done | tee file.links |
while read f
do firefox -remote "openURL(\"$f\",new_tab)
done

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks phv,

I seem to be getting a weird error though. I got it last night as well but I just rebooted and it went away, unfortunately I don't have such success this morning ....
Code:
(firefox-bin:7460): Gdk-WARNING **: cannot set locale modifiers
Error: No running window found
when I try the
Code:
firefox -remote "openURL(\"$f\",new_tab)"

any ideas why this problem comes and goes ??
 
Perhaps this instead ?
firefox -remote "openURL($f,new_tab)"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top