• C

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

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);
}
ww111697Asked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
execlp("sh","sh","-c","echo $SHELL",NULL);
else
execlp("sh","sh","-c","echo *.c",NULL);
0
 
ww111697Author Commented:
It is very good. Thank you very much
0
 
ww111697Author Commented:
It is very good. Thank you very much
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.