Solved

execlp("echo","echo","$SHELL",NULL")

Posted on 2002-07-21
3
1,050 Views
Last Modified: 2010-05-18
in the following code, why $SHELL and *.c will not be expanded by Unix shell?

int main()
{ if (fork()==0)
      execlp("echo","echo","$SHELL",NULL);
  else  
      execlp("echo","echo","*.c",NULL);
}
0
Comment
Question by:ww111697
  • 2
3 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 50 total points
ID: 7168492
execlp("sh","sh","-c","echo $SHELL",NULL);
else
execlp("sh","sh","-c","echo *.c",NULL);
0
 

Author Comment

by:ww111697
ID: 7169560
It is very good. Thank you very much
0
 

Author Comment

by:ww111697
ID: 7169562
It is very good. Thank you very much
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question