rendered paste body#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
#include <sys/wait.h>
int main()
{
char **argv;
char *temp;
char command[100];
argv = malloc(sizeof(char)*2);
printf("\n****** My shell starts here ******\n");
printf("\n**********************************\n");
printf("myBash$> ");
char **enviro = '\0';
/*Read command and other agruments from stdin*/
while(fgets(command,100,stdin) != NULL && (printf("myBash$> ") != -1))
{
temp = (argv[0] = strtok(command," \t\n"));
if(temp != NULL)
{
pid_t child;
/*if input is exit*/
if(!strcmp("exit",argv[0]))
{
free(argv);
exit(0);
}
if(!(child = fork()))
{
execve("/bin/ls",argv,enviro);
}
}
}
free(argv);
return 0;
}