lb report.docx - NATIONAL UNIVERSITY OF MODERN LANGUAGES...

This preview shows page 1 - 10 out of 40 pages.

NATIONAL UNIVERSITY OF MODERN LANGUAGESOperating SystemsLab reportSubmitted By:Hasnat Ali Ibrar 12081Submitted To:Sir Naveed AhmedClass:BSSE IV (Morning)Date:12-01-2021
ContentsLAB 01..................................................................................................................................................31Effects of quotes on the absolute path of the library files..........................................................4LAB 02..................................................................................................................................................62.1Parameters and environment variables...................................................................................7LAB 03..................................................................................................................................................93.Implementation of control structure in Linux..........................................................................103.1Implementation of do while loop in Linux...........................................................................113.2Implementation of do while loop in Linux using conditional operators...............................13LAB 04................................................................................................................................................144.Implementation of switch case structure in Linux...................................................................154.1Switch case structure in Linux by putting patterns together.................................................164.2Implementation of switch case structure in Linux by putting patterns together and executingmultiple statement...........................................................................................................................174.3Implementation of concatenation operator in Linux............................................................184.4Implementation of array in Linux........................................................................................19LAB 05................................................................................................................................................215.Implementation of functions in Linux......................................................................................225.1Implementation of transformation operator in Linux...........................................................24LAB 06................................................................................................................................................256.Implementation of file handling system calls in Linux............................................................26LAB 07................................................................................................................................................287.Implementation of fopen fgetc() system call to countthe no of characters in a file................297.1Implementation of fprintf() system call in Linux.................................................................31LAB 08................................................................................................................................................338.Implementation of fork() and getpid() system call in Linux....................................................34LAB 09................................................................................................................................................369.Implementation of opendir and readdir system call.................................................................37LAB 10................................................................................................................................................3910.Implementation of FPUTC (file put character) system call..................................................402
LAB 013
1Effects of quotes on the absolute path of the library filesCommands:cat > lab1ctrl+Dgedit lab1Code:#!/bin/shmyvar="Hi I am here"echo $myvarecho "$myvar"echo '$myvar'echo \$myvarecho "Enter something"read myvarecho '$myvar' now equal $myvarexit 0commands:$read = input$chmod +x lab1$./lab14
output:5
LAB 026
2.1Parameters and environment variablesCommands:$cat > lab2$Ctrl+D$gedit lab2Code:#!/bin/shsalutation="Hello welcome"echo $salutationecho "The program $0 is now running"echo "The second parameter was $2"echo "The first parameter was $1"echo "The third parameter was $3"echo "The parameter list was $*"echo "The user's home directory is $HOME"echo "The list of arguments are [email protected]"echo "The total numbers of arguments are $#"echco "The process ID of the shell script is $$"echo "The terminal in which you are currently working is $TERM"echo "Please enter a new greeting"read salutationecho $salutationecho "The script is now complete"exit 0commands:$chmod +x lab02$./lab02 ENG OS DSA STAT MATH7
Output:8
LAB 039

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 40 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
Amir Raheem
Tags
Unix SUS2008 utilities, Greeting

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture