Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.

Re: Is there a system command in Linux

by tcf03 (Deacon)
on Dec 29, 2007 at 09:44 UTC ( [id://659461]=note: print w/replies, xml ) Need Help??

in reply to Is there a system command in Linux

#!/usr/bin/perl use strict; use warnings; $ENV{PATH}="/usr/bin:/usr/local/bin:/bin"; system("firefox");

If you want a default browser, and its under your control you could have users set an environmental var like export BROWSER='/usr/bin/firefox' Other than that, certain distros may have some facility for getting at that, but it would most likely be distro specific. Your mileage may vary.

Untested, but you could also try something such as
#!/usr/bin/perl # use strict; use warnings; $ENV{PATH}="/usr/bin:/usr/local/bin:/bin"; my @browsers = qq|firefox lynx|; USEBROWSER: { for (@browsers) { my $status = (system("$_") == 0 ) ? 0 + : 1; last USEBROWSER if $status == 0; } print "No suitable browser was found...\n"; }
"That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
  --Ralph Waldo Emerson

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://659461]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-05-21 23:46 GMT
Find Nodes?
    Voting Booth?

    No recent polls found