Advertisement
Rakibul_Ahasan

Untitled

Mar 23rd, 2021
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. 1)
  2.  
  3. whoami
  4.  
  5. 2)
  6.  
  7. touch greatl.txt grfatl.txt greftl.txt grertl.txt grratl.txt grertl.txt grretl.txt
  8. ls g???tly.txt
  9.  
  10. 3)
  11.  
  12. sed -n 2,6p status.report
  13.  
  14. 4)
  15. chmd +wr
  16. chmod 666 year2020
  17.  
  18. 5)
  19.  
  20. grep best status.report
  21. grep best status.report | cat > extracted.txt
  22.  
  23. 6)
  24.  
  25. ls section*
  26. ls section1 section2 section3
  27.  
  28. 7)
  29. cat part1 part2 > book
  30.  
  31. 8)
  32.  
  33. ! /usr/bin/bash
  34.  
  35. first program
  36.  
  37. echo "Script started..."
  38. read -p "Enter the file name: " file
  39.  
  40. totalLine=$(wc -l < $file)
  41. totalWord=$(wc -w < $file)
  42. totalBite=$(wc -c < $file)
  43. ((totalLine+=1))
  44.  
  45. echo "Total number of lien(s) in $file is: $totalLine";
  46.  
  47. echo "Total number of words(s) in $file is: $totalWord";
  48.  
  49. echo "Total number of bites(s) in $file is: $totalBite";
  50.  
  51.  
  52. 9)
  53.  
  54. Sjf
  55.  
  56. !/bin/bash
  57.  
  58.  
  59. clear ;
  60. n=0;
  61.  
  62. read -p "Echo number of process: " n;
  63.  
  64. declare -a bt[n];
  65. declare -a p[n];
  66. declare -a wt[n];
  67. declare -a tat[n];
  68.  
  69. bt[0]=0
  70. # get burst time
  71. echo "Enter Burst time: ";
  72. for((i=0; i<n; i++)); do
  73. ((N=i+1))
  74. read -p "process $N: " bt[i];
  75. (( p[$i]=i+1 ))
  76. done
  77.  
  78. btn=( $( printf "%s\n" "${bt[@]}" | sort -n ) )
  79. (( wt[0]=0 ))
  80.  
  81. for (( i = 1; i < n; i++ )); do
  82. (( wt[i]=0 ))
  83. for(( j = 0; j < i; j++ )); do
  84. (( wt[i]+=btn[j] ))
  85. done
  86. (( total+=wt[i] ))
  87. done
  88.  
  89. (( avg_wt=total/n ))
  90. (( avg_wt+=total%n ))
  91. (( total = 0))
  92.  
  93. echo "Process Burst Time Waiting Time Turnaround Time";
  94. for(( i = 0; i < n; i++ ))
  95. {
  96. (( tat[i]=btn[i]+wt[i] ))
  97. (( total+=tat[i] ))
  98. echo "${p[i]} ${btn[i]} ${wt[i]} ${tat[i]}"
  99.  
  100. }
  101.  
  102. (( avg_tat=total/n ))
  103. (( avg_tat+=total%n ))
  104.  
  105. echo "Average Waiting Time= " $avg_wt;
  106. echo "Average Turnaround Time= " $avg_tat;
  107.  
  108. echo ;
  109. echo ;
  110.  
  111. read -p "Enter Burst time: " burst;
  112.  
  113.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement