OS Assignment 2 MyShell to do file operations
Custom shell in C TheLazyBusyCoder's Blog Welcome to my coding adventures! In this post, we'll explore a C program. Write a C program to implement the toy shell. It should display the command prompt “myshell$”. Tokenize the command line and execute the given command by creating the child process. Additionally it should interpret the following commands. count c filename :- To print number of characters in the file. count w filename :- To print number of words in the file. count l filename :- To print number of lines in the file. #include <unistd.h> #include <fcntl.h> #include <stdio.h> #include <string.h> #include <sys/wait.h> // seperate sentence: "count c filename" => count , c , filename void make_toks(char *s, char *tok[]) { int i = 0; char *p; p = str...
Comments
Post a Comment