Ich habe ein Problem mit der Systemfunktion. Wenn ichWarum kann die Systemfunktion unter Linux dieses Shellskript nicht ausführen?
echo -e '\x2f'
in Shell ausgeführt, ist der Ausgang /
aber wenn ich den Befehl in C-Programm wie gesagt:
int main(int argc, char* argv[], char** envp)
{
printf("The command is :%s\n",argv[1]);
system(argv[1]);
return 0;
}
Ausgabe lautet:
The command is :echo -e '\x2f'
-e \x2f
Warum funktioniert die system
Funktion Ausgabe '-e \x2f
' anstelle von '/
'
BTW, verwende ich Python zur Eingabe des 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())
Da das Skript von '/ bin/sh' und nicht von'/bin/bash' und '/ bin/sh' ausgeführt wird, werden die Dinge nicht wie'/bin/bash' interpretiert. –