|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
Hi guys. My first post, so be gentle... On my Solaris 10 machine vnc server is running. I need a command to extract most recent client session number (screen). So with: Code: Code:
bash-3.2# ps -ef | grep vnc | grep Xaut
root 19805 19797 0 15:41:44 ? 0:01 Xvnc :4 -inetd -once -securitytypes=none -desktop Infinera DNA -auth //.Xauthor
root 19785 19777 0 15:41:24 ? 0:01 Xvnc :3 -inetd -once -securitytypes=none -desktop Infinera DNA -auth //.Xauthor
root 19765 19757 0 15:41:00 ? 0:01 Xvnc :2 -inetd -once -securitytypes=none -desktop Infinera DNA -auth //.XauthorI can see them all. Then with Code: Code:
bash-3.2# ps -ef | grep vnc | grep Xau| sort -k4 | tail -1 | awk '{print $9}' | tr -d ':'
4I get what I need - just number 4. I've created few Firefox profiles called vnc1, vnc2, vnc3 and vnc4. Now I am trying to use above command to choose the profile name which correlates with session number in firefox command in /.vnc/xstarup: Code: Code:
#!/bin/sh
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
twm &
firefox -P vnc$(ps -ef | grep vnc | grep Xau| sort -k4 | tail -1 | awk '{print $9}' | tr -d ':') &However Firefox is not deriving correct profile name from the command. For this example it should be - firefox -P vnc4 Vnc is showing this error in the log file: Code: Code:
//.vnc/xstartup: syntax error at line 6: `)' unexpected Could you please let me know what's wrong with firefox command syntax? Cheers, cp6uja
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
To keep the forums high quality for all users, please take the time to format your posts correctly.
First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.) Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red. Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property. Thank You. The UNIX and Linux Forums |
|
#4
|
|||
|
|||
|
When you type that code into your terminal, you are using bash.
When you run that from a script, you are using /bin/sh, which may be something totally different, something that doesn't understand $( ) syntax, only backticks ` `. |
| The Following User Says Thank You to Corona688 For This Useful Post: | ||
cp6uja (04-26-2012) | ||
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Many thanks guys. Now it looks so obvious, but I would've never thought of it myself.
|
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
(The other posters have diagnosed this problem correctly).
On Solaris 10 the /bin/sh is the original Bourne Shell which does not recognise many of the Shell extensions which are available in bash and ksh . On other modern unix Operating Systems you can find that /bin/sh is actually the Posix Shell or on many Linux systems it is bash. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| simple php/expect script works from command line but not from web | jacksona2 | Shell Programming and Scripting | 7 | 06-02-2011 12:50 PM |
| Works on command line but not in script | anthonyjstewart | UNIX for Dummies Questions & Answers | 4 | 03-04-2011 09:29 AM |
| This code works in the command line but not in a shl script | rechever | Shell Programming and Scripting | 1 | 04-06-2010 09:36 AM |
| Zgrep works at command line but not in script? | Cailet | Shell Programming and Scripting | 2 | 05-06-2009 01:07 AM |
| script works on command line, not in cron job | JackTheTripper | UNIX for Dummies Questions & Answers | 7 | 06-27-2007 01:51 AM |
|
|