Welcome to Dream.In.Code
Become an Expert!

Join 149,478 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,570 people online right now. Registration is fast and FREE... Join Now!




Unix question

 
Reply to this topicStart new topic

Unix question

Emper0r
1 May, 2007 - 10:45 PM
Post #1

D.I.C Head
**

Joined: 7 Dec, 2006
Posts: 59


My Contributions
Hey guys, how do you make a variable accessible to a subshell in Bash in Unix?? Also, do you use for OR aka || in a pathname? Is it ||? Thanks for any help.
User is offlineProfile CardPM
+Quote Post

tody4me
RE: Unix Question
2 May, 2007 - 05:29 AM
Post #2

Only Jenny Craig makes thin clients...
Group Icon

Joined: 12 Apr, 2006
Posts: 1,349



Thanked: 5 times
Dream Kudos: 100
My Contributions
What are you looking for in a subshell? are you asking in cli how do you use variables? For the OR statement in bash, it's || and it sounds like you wanted to say something like if <path1> || <path2> which would translate to if <path1> OR <path2>.
User is offlineProfile CardPM
+Quote Post

ajwsurfer
RE: Unix Question
29 May, 2007 - 10:13 AM
Post #3

D.I.C Regular
Group Icon

Joined: 24 Oct, 2006
Posts: 298



Thanked: 2 times
Dream Kudos: 50
My Contributions
There are several ways to do this, but the simplest and most obvious is to use the system() function from the stdlib.h lilbrary.
Example:
CODE

  #include stdlib.h
  ...  
  int main()
  {
   ...
    int result = system("export var=5");
   ...
  }


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 03:49PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month