I have a simple script to start a node.js webserver and open the URL in a browser. However the last part doesn't seem to work, it wont open the URL in a browser (or anywhere else).
This is the code I got so far:
#!/bin/bash
node server.js;
xdg-open http://localhost:9000/;
Everywhere I search I find the same, I have to use:
xdg-open URL
but it only seems to work while typing that in the terminal, not in my startserver.sh file. It will start the server but not open the URL, typing the code in a terminal however does seem to work.
It's confusing, why doesn't it work inside my script?
sleep 2
orsleep 5
between the two commands.x-www-browser URL
. This will open the URL in the default browser