#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
char *buff,*t1,*t2,*t3,ch;

main()
{
   int n;
   clrscr();
   while(1)
   {
printf("myshell$");
fflush(stdin);
t1=(char *)malloc(80);
t2=(char *)malloc(80);

buff=(char *)malloc(80);
fgets(buff,80,stdin);
n=sscanf(buff,"%s %s %s",t1,t2);
if(strcmp(t1,"exit")==0)
exit(0);

if(strcmp(t1,"mkdir")==0)
{
  if(mkdir(t2)==-1)
   perror(" ");
  else
  {
   mkdir(t2);
     mkdir();

  }
}


else if(strcmp(t1,"rmdir")==0)
{

 if(rmdir(t2)==-1)
   perror(" ");
 else
  {
   rmdir(t2);
  }
}
else if(strcmp(t1,"cd")==0)
{

 if(chdir(t2)==-1)
   perror(" ");
 else
  {
   chdir(t2);
  }
}

   }
}

2 Comments

  1. Replies
    1. myshell$ cd "dir name" eg.:- cd c:\tc

      myshell$ mkdir qwerty // create a folder of name "qwerty"

      myshell$cd qwerty // change dir by cd command

      myshell$mkdir xyz // inside qwery dir , make xyz folder

      myshell$rmdir xyz // than remove xyz by rmdir command

      Delete

Post a Comment

Previous Post Next Post