bash-3.2$ cat multiplication.sh #!/bin/bash # Example use of function/method declaration in Shell Programming # Example use of for loop #a function that will multiply 1 to 10 with 5 multiplication() { x=5 for i in {1..10} do echo $i echo “the multiplication result is:” $(($i*$x)) done } echo “Print 1 to 10; also multiply each …
Category: শেল প্রোগ্রামিং – Shell Programming
শেল প্রোগ্রামিং - Shell Programming
Apr 15
শেল – case এর ব্যবহার ksh – এ। Example use of Case in KSH. Show Today’s Day Name
bash-3.2$ cat ksh_case_example_1.sh #!/bin/ksh #show today’s day name DAY=`date +%a` #show value of $DAY echo $DAY #based on the value of the DAY variable show the day name in full format case “$DAY” in Mon) echo “Monday” ;; Tue) echo “Tuesday” ;; Wed) echo “Wednesday” ;; Thu) echo “Thursday” ;; Fri) echo “Friday” ;; Sat) …
Apr 15
গাণিতিক অপারেশন – ব্যবহারকারী থেকে দুটি মান ব্যবহার করে : Arithmetic operations using two values from the user
#!/usr/bin/bash clear echo “Enter First Number” read x echo “Enter Second Number” read y #does not work for /bin/sh (( z = $x + $y )) (( a = $x – $y )) (( b = $x \* $y )) (( c = $x \/ $y )) #clear echo “Addition of 2 numbers is =” …
Apr 15
এরিথমেটিক অপারেশন দুটি ভেরিয়েবল ব্যবহার করে
#!/bin/sh #will do addition, subtraction, multiplication, and division of two variables X=12 Y=5 #print the values of the variables echo “X value is: “$X echo “Y value is: “$Y #addition echo “X + Y” = `expr $X + $Y` #subtraction echo “Y – X” = `expr $Y – $X` #multiplication echo “X * Y” = …
Apr 15
ভেরিএবল এর ব্যবহার – use of variables
#!/bin/sh #assign value to a variable and print to the screen NAME=”Justetc” echo $NAME #Ask the user to enter a Name echo ################################## echo “enter name” #read command is used to take input from the user read X #print the value two times to the screen echo $X echo $X ————————— ফলাফল – Output bash-3.2$ …
Apr 15
একটি বেসিক শেল প্রোগ্রাম
#!/bin/sh #if enabled – will spit out the script to the screen #set -v #clear the screen clear echo “SCRIPT BEGINS” #shows current login name echo “Hello $LOGNAME” #shows current date in the same line echo “Todays date is: \c” date +%m/%d/%y #shows current time in the same line echo “and the current time is: …
- 1
- 2