LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-01-2003, 08:42 PM   #1
ducka
LQ Newbie
 
Registered: Sep 2003
Location: Australia, QLD
Posts: 13

Rep: Reputation: 0
Question Shell Variables.


Hi.. Im just working on a bash Shell script, and i have come across the line of code: prog=$"VNC server". I just assumed that it was a normal shell variable that stores the string VNC server, but then when i had a look at all the shell variables by typing the set command, a whole page or so of shell script poped up under the variable "prog". Obviously the prog=$"VNC server" thing retrieved a file and stored the contence under the shell variable, but where did this file come from? whats the deal with this?


Cheers!


Lucas

Last edited by ducka; 09-01-2003 at 08:44 PM.
 
Old 09-02-2003, 02:56 AM   #2
abd_bela
Member
 
Registered: Dec 2002
Location: algeria
Distribution: redhat 7.3, debian lenny
Posts: 627

Rep: Reputation: 31
hi,
to store a string you ned only var="tatat" whithout blanks around the "=" symbol

when you use var you need $ , echo $var

best regards
bela
 
Old 09-02-2003, 02:59 AM   #3
ducka
LQ Newbie
 
Registered: Sep 2003
Location: Australia, QLD
Posts: 13

Original Poster
Rep: Reputation: 0
thanks for that, but thats not quite the answer im chasing..


i wanted to know what exactly prog=$"VNC server" does. it seems to retrieve code from somewhere and store it under a shell variable.. i wanted to know how it does this, and where it comes from.

cheers!


Lucas
 
Old 09-02-2003, 10:05 AM   #4
SaTaN
Member
 
Registered: Aug 2003
Location: Suprisingly in Heaven
Posts: 223

Rep: Reputation: 33
#!/bin/bash
prog=$"VNC server"
echo $prog

The output of this program is the simple string

VNC server

So , i don't quite understand why you are getting a different output ....Maybe you could post the program

P.S :- VNC stands for "Virtual Network Computing "
Dunno how it is related to this . Did a bit of googling to find wat VNC is
 
Old 09-02-2003, 07:03 PM   #5
ducka
LQ Newbie
 
Registered: Sep 2003
Location: Australia, QLD
Posts: 13

Original Poster
Rep: Reputation: 0
Yeh. i know, i thought it was weird myself... I tested it out a few more times last night, and im not quite sure if it is that prog=$"VNC server" line of code that is doing what i mentioned in the above posts. As you said yourself, its just a string.

the script itself can be found on any linux redhat machine (could be other as well. im not sure) its called "vncserver".
here is a link to the code in html

http://www.realvnc.com/pipermail/vnc...st/024222.html

a good way to see what im talking about, as far as the shell variables, and all that code printing out under them is concernd, is to stick the "set" command at the end of the script. im pretty sure that it will spit it all out there.

i would post a dump of the shell variables i get up from it, but its much to large to stick here in the post, unless i put it in a text file.

n e way... cheers
Lucas
 
Old 09-03-2003, 05:38 PM   #6
Claus
Member
 
Registered: Jul 2003
Location: Santiago de Chile
Distribution: Debian testing/unstable
Posts: 74

Rep: Reputation: 15
Creo que lo que realmente hiciste fue:

prog=$(VNC server)

con lo cual guardas en la variable $prog la salida estandar del comando 'VNC server'.

Adios.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cron and shell env variables lt_wentoncha SUSE / openSUSE 5 07-16-2005 01:20 PM
Sub shell environment variables tnine9 Programming 1 06-08-2004 01:27 PM
Why?? can not use variables with shell script Bassam Linux - General 9 01-27-2004 07:42 AM
Setting Shell variables tmoorman Linux - Software 6 11-19-2003 03:41 PM
Makefiles and shell variables Snabber Linux - Software 1 08-05-2003 11:23 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration