C program that creates a child process to read commands from the standard input

#include #include #include int main() { int pid,status; char comd[20];pid=fork(); if(pid==0) { printf("child processn"); while(strcmp(comd,"exit")!=0) { printf("[user@localhost~]$"); gets(comd); system(comd); } exit(0); } else { wait(&status); printf("parent processn"); } } ****************************************…

Continue ReadingC program that creates a child process to read commands from the standard input

Shell script that performs following string handling operations i) Calculate the length of the string ii) locate a position of a character in a string iii) extract last three characters from string

#!/bin/sh str=tanu echo “string:$str” echo “lengh of string:” z=`expr “$str”:’.*’` echo $z echo “substring is” z=`expr “$str”:’.*(…)’` echo $z echo “position of character n is” z=`expr “$str”:’[^n]*n’` echo $z *******************…

Continue ReadingShell script that performs following string handling operations i) Calculate the length of the string ii) locate a position of a character in a string iii) extract last three characters from string

Shell Program that takes the any number of arguments and print them in same order and in reverse order with suitable messages

echo "program name: $0" if [ $# -eq 0 ] then exit fi echo "no: of arguments: $#" echo "the input arguments are" num=1 for i in "$@" do echo…

Continue ReadingShell Program that takes the any number of arguments and print them in same order and in reverse order with suitable messages