There might be an approximate way to do what you want (tested in Linux Debian 8). You could -- as a normal user, not root (see this for the reason) -- run the following command (on a terminal):
firefox "http://stackoverflow.com/search?q=my_search_term"
That would open firefox
on a Stack Overflow's page that would display the search results for the term my_search_term
.
If you need this code to be run on a script that runs as root
, it would still be possible to (safely) run this command if you run it as a "normal" user instead of root
, such as:
su - myuser -c 'firefox "http://stackoverflow.com/search?q=my_search_term"'
To find out who is the user
who should be used to run the command above, one of the best options would be to use the logname
command, such as:
myuser="$(logname 2>/dev/null)"
Note: This workaround of sorts would also works on many other web sites, such as Google, just substitute with the right url
address, such as:
firefox "http://www.google.com/search?q=my_search_term"