├── README.md ├── Shell Programming Code ├── Current Date And Time.sh ├── Check if a File exist.sh ├── string is a Palindrome.sh ├── Fibonacci .sh ├── factorial using Function.sh ├── factorial.sh ├── Count Occurrence in a File word.sh ├── Find the Largest and Smallest Number in Array.sh ├── Menu Driver Calculator.sh ├── FCFS Without Arrival Time.sh ├── SJF Without Arrival Time.sh ├── FCFS With Arrival Time.sh └── Priority Without Arrival Time.sh ├── Console Name.sh ├── Sumation.sh ├── factorial.sh ├── Pyramidh Pattern.sh ├── prime number.sh ├── shellcode.sh ├── Task Manager.sh └── Simple File Backup.sh /README.md: -------------------------------------------------------------------------------- 1 | # Basic-Sheel-Programming 2 | Operating System (Ubuntu) 3 | -------------------------------------------------------------------------------- /Shell Programming Code/Current Date And Time.sh: -------------------------------------------------------------------------------- 1 | echo "Current date and time: $(date)" 2 | -------------------------------------------------------------------------------- /Console Name.sh: -------------------------------------------------------------------------------- 1 | #PrintBranner 2 | figlet -f slant -c "SAJJAD JIM" | lolcat 3 | figlet -f digital -c "S.M. SAJJAD HOSSAIN JIM" | lolcat 4 | 5 | 6 | # nano ~/.bashrc 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Shell Programming Code/Check if a File exist.sh: -------------------------------------------------------------------------------- 1 | echo "Enter the file name:" 2 | read filename 3 | 4 | if [ -e "$filename" ] 5 | then 6 | echo "File exists" 7 | else 8 | echo "File does not exist" 9 | fi 10 | -------------------------------------------------------------------------------- /Shell Programming Code/string is a Palindrome.sh: -------------------------------------------------------------------------------- 1 | echo "Enter a string:" 2 | read str 3 | 4 | rev=$(echo $str | rev) 5 | 6 | if [ "$str" == "$rev" ] 7 | then 8 | echo "$str is a palindrome" 9 | else 10 | echo "$str is not a palindrome" 11 | fi 12 | -------------------------------------------------------------------------------- /Shell Programming Code/Fibonacci .sh: -------------------------------------------------------------------------------- 1 | echo "Enter the number of terms:" 2 | read n 3 | 4 | a=0 5 | b=1 6 | 7 | echo "Fibonacci sequence:" 8 | for ((i=0; i largest)) 10 | then 11 | largest=$num 12 | fi 13 | if ((num < smallest)) 14 | then 15 | smallest=$num 16 | fi 17 | done 18 | 19 | echo "Largest: $largest" 20 | echo "Smallest: $smallest" 21 | -------------------------------------------------------------------------------- /prime number.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Function to check if a number is prime 4 | is_prime() { 5 | local num=$1 6 | if [ "$num" -le 1 ]; then 7 | echo 0 8 | return 9 | fi 10 | for ((i = 2; i * i <= num; i++)); do 11 | if [ $((num % i)) -eq 0 ]; then 12 | echo 0 13 | return 14 | fi 15 | done 16 | echo 1 17 | } 18 | 19 | # Main script to sum prime numbers 20 | read -p "Enter a number N: " N 21 | sum=0 22 | 23 | for ((i = 2; i <= N; i++)); do 24 | if [ $(is_prime $i) -eq 1 ]; then 25 | sum=$((sum + i)) 26 | fi 27 | done 28 | 29 | echo "The sum of prime numbers between 1 and $N is: $sum" 30 | -------------------------------------------------------------------------------- /Shell Programming Code/Menu Driver Calculator.sh: -------------------------------------------------------------------------------- 1 | while true 2 | do 3 | echo -e "\nCalculator Menu" 4 | echo "1. Addition" 5 | echo "2. Subtraction" 6 | echo "3. Multiplication" 7 | echo "4. Division" 8 | echo "5. Exit" 9 | echo "Enter your choice:" 10 | read choice 11 | 12 | if ((choice == 5)) 13 | then 14 | echo "Exiting..." 15 | break 16 | fi 17 | 18 | echo "Enter two numbers:" 19 | read a 20 | read b 21 | 22 | case $choice in 23 | 1) echo "Result: $((a + b))";; 24 | 2) echo "Result: $((a - b))";; 25 | 3) echo "Result: $((a * b))";; 26 | 4) 27 | if ((b == 0)) 28 | then 29 | echo "Division by zero is not allowed" 30 | else 31 | echo "Result: $((a / b))" 32 | fi 33 | ;; 34 | *) echo "Invalid choice";; 35 | esac 36 | done 37 | -------------------------------------------------------------------------------- /Shell Programming Code/FCFS Without Arrival Time.sh: -------------------------------------------------------------------------------- 1 | # 1. FCFS Without Arrival Time 2 | # First-Come, First-Served (FCFS) scheduling without considering arrival time. 3 | # Processes are executed in the order provided. 4 | 5 | echo "Enter the number of processes:" 6 | read n 7 | 8 | echo "Enter burst times (space-separated):" 9 | read -a burst_time 10 | 11 | # Initialize waiting time and turnaround time 12 | waiting_time[0]=0 13 | turnaround_time[0]=${burst_time[0]} 14 | 15 | for ((i=1; i priority[j+1])) 19 | then 20 | # Swap priorities 21 | temp=${priority[j]} 22 | priority[j]=${priority[j+1]} 23 | priority[j+1]=$temp 24 | 25 | # Swap burst times 26 | temp=${burst_time[j]} 27 | burst_time[j]=${burst_time[j+1]} 28 | burst_time[j+1]=$temp 29 | fi 30 | done 31 | done 32 | 33 | waiting_time[0]=0 34 | turnaround_time[0]=${burst_time[0]} 35 | 36 | for ((i=1; i