#include #include #include #include int main() { int cmd; printf( "Enter 1=who, 2=ls, 3=uptime, 4=>emacs, 5=>hostname, 6=>date -> " ); scanf( "%d", &cmd ); while ( cmd != 0 ) { int pid = fork(); if ( pid == 0 ) { if ( cmd == 1 ) execl( "/usr/bin/who", "who", NULL ); if ( cmd == 2 ) execl( "/bin/ls", "ls", NULL ); if ( cmd == 3 ) execl( "/usr/bin/uptime", "uptime", NULL ); if ( cmd == 4 ) execl( "/usr/bin/emacs", "emacs", NULL ); if ( cmd == 5 ) execl( "/bin/hostname", "uptime", NULL ); if ( cmd == 6 ) execl( "/bin/date", "uptime", NULL ); exit( 1 ); } wait( NULL ); printf( "Enter 1=who, 2=ls, 3=uptime, 4=>emacs, 5=>hostname, 6=>date -> " ); scanf( "%d", &cmd ); } }