Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2002-07-21
3
Medium Priority
?
1,094 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 85

Accepted Solution

by:
ozo earned 200 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

Independent Software Vendors: 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

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…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
Suggested Courses

810 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