I meet a problem about system function. If I run
echo -e '\x2f'
in shell,the output is /
but when I put the command in C program like:
int main(int argc, char* argv[], char** envp)
{
printf("The command is :%s\n",argv[1]);
system( argv[1] );
return 0;
}
output is:
The command is :echo -e '\x2f'
-e \x2f
Why does the system
function output '-e \x2f
' instead of '/
'
BTW, I use Python to input the argv:
# I used \\ because python will transfer \x2f to / automatially
command="echo -e '\\x2f'"
p=process(executable='/home/cmd2',argv= ['/home/cmd2',command])
print (p.readall())