This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Enter the name of first file: " | |
read file1 | |
echo "Enter the name of second file: " | |
read file2 | |
fp1=`ls -l $file1|cut -c 2-10` | |
fp2=`ls -l $file2|cut -c 2-10` | |
if [ $fp1 = $fp2 ] | |
then | |
echo "Files $file1 and $file2 have same permission $fp1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
#include<unistd.h> | |
void main() | |
{ | |
char command[20]; | |
int ch,pid=fork(); | |
if(pid==0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Non Recursive shell Script" | |
echo "The total number of arguments specified:$#" | |
echo "The given $# arguments are :$*" | |
temp1=$# | |
echo "The arguments in reverse order:" | |
while [ $temp1 -ge 1 ] | |
do | |
eval echo \$$temp1 | |
temp1=`expr $temp1 - 1` | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
#include<stdio.h> | |
#include<stdlib.h> | |
%} | |
%token A B | |
%% | |
str: s '\n' { return 0;} | |
s : x B ; | |
x : A A A A A A A A A A T ; | |
T: T A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
/* 6.l Yacc program to recognize the grammar AnB where n ≥ 10 */ | |
#include "y.tab.h" | |
%} | |
%% | |
a return A; | |
b return B; | |
. return yytext[0]; | |
\n return yytext[0]; | |
%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
/* 6.l Yacc program to recognize the grammar AnB where n ≥ 10 */ | |
#include "y.tab.h" | |
%} | |
%% | |
a return A; | |
b return B; | |
. return yytext[0]; | |
\n return yytext[0]; | |
%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
/* 5b.l Program for the grammar AnBn where n≥0 */ | |
#include "y.tab.h" | |
%} | |
%% | |
a {return A;} | |
b {return B;} | |
. {return yytext[0];} | |
\n {return yytext[0];} | |
%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
#include<stdio.h> | |
#include<stdlib.h> | |
/* 5b.y Program for the grammar AnBn where n≥0 */ | |
%} | |
%token A B | |
%% | |
str: s '\n' { return 0;} | |
s : A s B ; | |
| ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
#include <stdio.h> | |
#include<stdlib.h> | |
%} | |
%token NUM | |
%left '+' '-' | |
%left '*' '/' | |
%% | |
expr : e { printf(" Result : %d\n",$1); return 0;}; | |
e : e '+' e {$$=$1+$3;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
#include<stdlib.h> | |
#include "y.tab.h" | |
extern int yylval; | |
%} | |
%% | |
[0-9]+ { yylval=atoi(yytext); return NUM; } | |
[\t] ; | |
\n return 0; | |
. return yytext[0]; |