Your IP : 216.73.216.40


Current Path : /var/www/html/bibhas.ghoshal/lab_files/
Upload File :
Current File : //var/www/html/bibhas.ghoshal/lab_files/lab1.tex.backup

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{color}
%opening
\title{Lab 2 : System Calls}
%\author{}

\begin{document}

\maketitle

\underline{\textbf{Objective : }}
\begin{itemize}
 \item Lab 2 is intended to provide the way to use the most common system calls in order to make input-output operations on files, as well as operations to handle files and directories in Linux
\end{itemize}



\underline{\textbf{Recommended Systems/Software Requirements}}:\\
\begin{itemize}
 \item Any flavour of Linux
\end{itemize}


\underline{\textbf{References:}}
\begin{enumerate}
 \item \emph{Unix concepts and applications}, Fourth Edition, Sumitabha Das, TMH.
 \item \emph{Unix and shell Programming}, B.A. Forouzan \& R.F. Giberg, Thomson.
 \item \emph{Beginning shell scripting}, E. Foster, Johnson \& other, Wile Y- India
\end{enumerate}


\textbf{Theoretical Background}\\









\underline{\textbf{Experiment 1 : Basic Unix commands}}\\


\



\begin{enumerate}
 \item In lecture classes,we described a program that copies the contents of one file to a destination file. This program works by first prompting the user for the name of the source and destination files. Write this program using POSIX API. Be sure to include all necessary error checking, including ensuring that the source file exists. Once you have correctly designed and tested the program, if you used a system that supports it, run the program using a utility that traces system calls. Linux systems provide the \emph{ptrace} utility.

\item 

\item \begin{enumerate}
       \item pipe your \textbf{/etc/passwd} file to \emph{awk}, and print out the \textbf{home} directory of each user.
       \item Develop an interactive \emph{grep} script that asks for a word and a file name and then tells how many lines contain that word.
      
      \end{enumerate}



\end{enumerate}


\underline{\textbf{Experiment 2 : Shell Scripting}}\\

   \begin{enumerate}
    \item Write a shell script program to display list of user currently logged in.
    \item Write a (i) shell script program an (ii) \emph{C} program to display “HELLO WORLD” 
         \begin{itemize}
          \item Compare the running time of both the programs using \emph{time} command
         \end{itemize}
    \item \begin{enumerate}
           \item Write a shell script that takes a command –line argument and reports on whether it is directory, a file, or something  
                 else.
           \item Write a shell script that accepts one or more file name as arguments and converts all of them to uppercase, provided they exist in the current directory.
           \item Write a shell script that determines the period for which a specified user is working on the system.
          \end{enumerate}

    \item \begin{enumerate}
           \item Write a shell script that accepts a file name, starting and ending line numbers as arguments and displays all the lines between the given line numbers.
           \item Write a shell script that deletes all lines containing a specified word in one or more files supplied as arguments to     
                 it.
          \end{enumerate}

    \item Write a shell Script program to check whether the given number is even or odd
    \item Write a shell script Program to search whether element is present is in the list or not
    \item Write a shell script which receives two file names as arguments. It should check whether the two file contents are same or not. If they are same then second file should be deleted.
    \item Develop an interactive script that ask for a word and a file name and then tells how many times that word occurred in the file
    \item Write a shell script to perform the following string operations:
       \begin{enumerate}
        \item To extract a sub-string from a given string
        \item To find the length of a given string
       \end{enumerate}

    \item Write a shell script program to display the process attributes
    \item Write a shell script to change the ownership of processes
   \end{enumerate}


\end{document}