Solved

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

Posted on 2002-07-21
3
1,024 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
Comment Utility
execlp("sh","sh","-c","echo $SHELL",NULL);
else
execlp("sh","sh","-c","echo *.c",NULL);
0
 

Author Comment

by:ww111697
Comment Utility
It is very good. Thank you very much
0
 

Author Comment

by:ww111697
Comment Utility
It is very good. Thank you very much
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
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 recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

762 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

6 Experts available now in Live!

Get 1:1 Help Now