Commit 8ca454d9 authored by Aditya Pradhan's avatar Aditya Pradhan

CS699 inlab2 assignment

parents
#!/bin/bash
resa=$(( $1 + 1 ))
resb=$(( 2 * $1 + 1 ))
resc=$(( $1 * $resa * $resb ))
result=$(( $resc / 6 ))
echo "$result"
#!/bin/bash
filepath="$1"
cd "$filepath"
ls -l | grep ^d | wc -l
#!/bin/bash
cat q3_in.txt | grep '. *5.*' | sort > q3_out.txt
This diff is collapsed.
#!/bin/bash
counter=0
sum=0
mean=0
for number in `cat q4-in.txt`
do
allNumbers[counter]=$number
sum=$(($sum + ${allNumbers[$counter]}))
let counter=counter+1
done
mean=`bc -l <<< $sum/$counter`
sortedArray=($(echo ${allNumbers[*]} | tr " " "\n" | sort))
if [ $((counter%2)) -eq 0 ]
then
num1=${sortedArray[$(($counter / 2 - 1))]}
num2=${sortedArray[$(($counter / 2))]}
sumOfBoth=$((num1+num2))
median=`bc -l <<< $sumOfBoth/2`
else
median=$((${sortedArray[$(($counter / 2))]}))
fi
echo "$mean"
echo "$median"
Team Members:
1. Aditya Pradhan (Roll number: 203059006, CSE LDAP ID: pradhanaditya)
2. Ajinkya Jumbad (Roll number: 203050032, CSE LDAP ID: ajinx)
3. Prashant Ravi (Roll number: 203050082, CSE LDAP ID: prashantravi)
4. Rajneesh Katkam (Roll number: 203050086, CSE LDAP ID: rajneeshkatkam)
Contributions:
1. Aditya Pradhan wrote the script for Problem 4.
2. Ajinkya Jumbad wrote the script for Problem 3.
3. Prashant Ravi wrote the script for Problem 1.
4. Rajneesh Katkam wrote the script for Problem 2.
Uploaded by Aditya Pradhan on git cse, LDAP ID: pradhanaditya
References:
1. https://github.github.com/training-kit/downloads/github-git-cheat-sheet.pdf
2. https://stackoverflow.com/questions/12722095/how-do-i-use-floating-point-division-in-bash
3. https://www.baeldung.com/linux/use-command-line-arguments-in-bash-script
4. https://ubuntu-maryland.org/presentations/reference_bash-cheat.pdf
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment