[SOLVED] Command working on command line but not in shell script
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Doesn't mean it will work for you, but you have to forward the vnc protocol to something to interpret it... a vnc server. (I think I got that right, the page includes a "vncvewer" in some of its operation)
Doesn't mean it will work for you, but you have to forward the vnc protocol to something to interpret it... a vnc server. (I think I got that right, the page includes a "vncvewer" in some of its operation)
The solution from szboardstretcher works over ssh though. Even www-data can execute that shell script successfully now. So my problem is solved.
The -- tells the shell to stop interpreting past that --. Which would put the '' in question. The '' is basically dropped by the shell before it gets to vncserver when it is interpreted.
The -- tells the shell to stop interpreting past that --. Which would put the '' in question. The '' is basically dropped by the shell before it gets to vncserver when it is interpreted.
vncserver -- :1 &
should also work (in theory).
When everything past that -- isn't interpreted, where's the point to write something past it then? Don't understand unfortunately.
Both versions don't work fot me by the way. It says "Unrecognized option: --".
When everything past that -- isn't interpreted, where's the point to write something past it then? Don't understand unfortunately.
Both versions don't work fot me by the way. It says "Unrecognized option: --".
It's a shell thing. The shell tends to interpret the parameters BEFORE it passes the parameters. Doubly odd since the -- should have been stripped off by the shell, aka interpreted and not passed. Which implies that $(vncserver -- :1) isn't being run in a "shell script". Did you leave out the shebang? #!/bin/bash. Not that it matters, if it doesn't work leaving it out would be the saner thing to do.
I should probably test things, but I don't use vncserver. At least not in the past ten years. X2go, ssh with X forwarding and other routes to do roughly the same thing these days. Not that I've used any of those either. But I do like dividing my screen real-estate up with Xephyr to stack it vertically with Xdmx, so I can fit hundreds of lines of code on screen without needing multiple screens. Or fit the entire output of top on screen in our bloated systemd world.
the "--" is evaluated as well as anything following it, then all of the results are passed to the application.
How the "--" is handled by the application is up to the application itself. It is USUALLY used to indicate parameters that are to be passed to yet another application, an not used by the base application. This is why the "startx" application uses it. The parameters following the "--" are passed to the X server.
It's a shell thing. The shell tends to interpret the parameters BEFORE it passes the parameters. Doubly odd since the -- should have been stripped off by the shell, aka interpreted and not passed. Which implies that $(vncserver -- :1) isn't being run in a "shell script". Did you leave out the shebang? #!/bin/bash. Not that it matters, if it doesn't work leaving it out would be the saner thing to do.
The -- doesn't seem to get interpreted by the shell. There's no difference if I put "#!/bin/bash" on the first line of the shell script or not. The -- is always being passed with the rest of the command. It always results in "Unrecognized option: --".
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.