Sunday 17 May 2015

Linux : executing multiple commands from command line

Command line argument is used to giving input to our prgrame at load time. Using this simple code we can execute multiple commands. Here i used exec family of functions to execute each commands. Whenever we  are using using exec family of functions try to execute the exec function in child process.

Note : How to rrun this code from terminal
           $ ./a.out "ls;pwd;cal"
           $  ./a.out "ls;pwd;cal;umask;ps -e"

No comments:

Post a Comment