Solved

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

Posted on 2002-07-21
3
1,037 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ho to creat split-view application in iPad that display PDF file?? 3 151
List out all word 7 285
Global Keyboard Hooks Blocked 4 75
delete-remove 14 84
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
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…
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.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

816 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now