Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1)
- whoami
- 2)
- touch greatl.txt grfatl.txt greftl.txt grertl.txt grratl.txt grertl.txt grretl.txt
- ls g???tly.txt
- 3)
- sed -n 2,6p status.report
- 4)
- chmd +wr
- chmod 666 year2020
- 5)
- grep best status.report
- grep best status.report | cat > extracted.txt
- 6)
- ls section*
- ls section1 section2 section3
- 7)
- cat part1 part2 > book
- 8)
- ! /usr/bin/bash
- first program
- echo "Script started..."
- read -p "Enter the file name: " file
- totalLine=$(wc -l < $file)
- totalWord=$(wc -w < $file)
- totalBite=$(wc -c < $file)
- ((totalLine+=1))
- echo "Total number of lien(s) in $file is: $totalLine";
- echo "Total number of words(s) in $file is: $totalWord";
- echo "Total number of bites(s) in $file is: $totalBite";
- 9)
- Sjf
- !/bin/bash
- clear ;
- n=0;
- read -p "Echo number of process: " n;
- declare -a bt[n];
- declare -a p[n];
- declare -a wt[n];
- declare -a tat[n];
- bt[0]=0
- # get burst time
- echo "Enter Burst time: ";
- for((i=0; i<n; i++)); do
- ((N=i+1))
- read -p "process $N: " bt[i];
- (( p[$i]=i+1 ))
- done
- btn=( $( printf "%s\n" "${bt[@]}" | sort -n ) )
- (( wt[0]=0 ))
- for (( i = 1; i < n; i++ )); do
- (( wt[i]=0 ))
- for(( j = 0; j < i; j++ )); do
- (( wt[i]+=btn[j] ))
- done
- (( total+=wt[i] ))
- done
- (( avg_wt=total/n ))
- (( avg_wt+=total%n ))
- (( total = 0))
- echo "Process Burst Time Waiting Time Turnaround Time";
- for(( i = 0; i < n; i++ ))
- {
- (( tat[i]=btn[i]+wt[i] ))
- (( total+=tat[i] ))
- echo "${p[i]} ${btn[i]} ${wt[i]} ${tat[i]}"
- }
- (( avg_tat=total/n ))
- (( avg_tat+=total%n ))
- echo "Average Waiting Time= " $avg_wt;
- echo "Average Turnaround Time= " $avg_tat;
- echo ;
- echo ;
- read -p "Enter Burst time: " burst;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement