Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Shop
    1. Home
    2. binurayeshan
    3. Best
    • Profile
    • Following 3
    • Followers 2
    • Topics 18
    • Posts 35
    • Best 19
    • Controversial 0
    • Groups 3

    Best posts made by binurayeshan

    • Lets talk about bash script

      bash script කියන්නෙ linux environment එකේ වැඩ කරන්කොට අපිට හම්බුවෙන script language එකක්. ගොඩක්ම මේ bash scripting අවශ්‍ය වෙන්නෙ linux administrator ඒ වගේම ethical hacking ගැන උනන්දු වන අයට. ඇත්තටම bash script එකක් ගත්තම ඒක linux command වල එකතුවක් විදියට දකින්නත් පුලුවන්.

      posted in Linux
      binurayeshan
      binurayeshan
    • First bash script

      bash script file හදාගන්න විදිය..

      ඔයාගේ Terminal එක open කරන්න.
      ඒකෙ මෙන්න මේ command ටික දෙන්න -

      cd Desktop  #මේ කියන්නෙ ඔයාගෙ Desktop directory  එකට යන්න කියල 
      mkdir bash #මේ කියන්නෙ bash කියල folder එකක් හදන්න කියල 
      cd bash #මේ කියන්නෙ ඔයාගෙ bash කියල හදපු folder එකට යන්න කියල 
      touch ex1.sh #මේ කියන්නෙ ex කියන නමෙන් file එකක් හදන්න කියල ඒකෙ extension එකට මම දෙන්ව .sh කියල මොක්ද අපි හදන්නෙ bash file එකක් හින්ද
      

      දැන් ඔයාගෙ bash file එක හදල ඉවරයි. දැන් ඔයාට script එක ලියන්න පුලුවන්. දැන් ඔයා ඒ හදපු bash file එක sublime text හරි text editor එකක හරි open karaganna.

      #!/bin/bash 
      
      echo "Hellp bash"
      

      දැන් ඔයාගෙ terminal එකට ආයිත් ගිහින් මෙන්න මේ command ටික දෙන්න

      chmod +x ex1.sh  #මේ කියන්නෙ මේ file එකට  executable permission දෙන්න කියල
      ./ex1.sh #දැන් ඔයාට මේ file එක run කරන්න පුලුවන්
      
      posted in Linux
      binurayeshan
      binurayeshan
    • Sum of two numbers in bash script

      හරි අපි පලෙවෙනි script එකෙන් කතා කලා කොහමද bash script එකක් use karala දෙයක් print කරන්නෙ කියල අද අපි බලමු කොහොමද arithmatic operatorse use කරන්නෙ කියල.

      මම ඔයාලට කලින් post එකෙ කියල දුන්න විදියට bash script file එක හදාගන්න - https://lankadevelopers.com/topic/372/first-bash-script

      #!/bin/bash 
      
      num1=250 #value assign කරන විදිය 
      num2=500 #මතක තියාගන්න මෙ වගේම space තියන්නෙ නැතුව script එක ලියන්න 
      echo "number 1 = " $num1#number 1 එකේ value එක print කරන විදිය 
      echo "number 2 = " $num2
      echo "number 1 + number 2 =" $[num1 + num2]#value දෙකක් එකතු කරන විදිය 
      
      

      ඊට පස්සෙ මේ Script file එකට permission දීලා Run කරන්න

      posted in Linux
      binurayeshan
      binurayeshan
    • Understand permission of a file in Linux

      මම දැන් ඔයාලට කියල දෙන්න යන්නෙ කොහොමද අපි linux වලදි file එකකට read, write, execute කියන permission දෙන්නෙ කියල මේ post එකේදි මන් කියල දෙන්නම් කොහොමද permission check කරන්නෙ කියලා

      හරි මම මුලින්ම file එකක් හදනව
      0_1569374198712_Screen Shot 2019-09-25 at 6.46.17 AM.png

      ඔයාලට දැන් පේනව මේ file එකේ -rw-r--r-- කියල අකුරු වගයක් තියෙනව මේ තියෙන්නෙ users ලට permission බෙදිල යන විදිය.

      මේ තියෙන්නේ ප්‍රධාන permission 3
      r - read
      w - write
      x - execute

      0_1569374595380_Screen Shot 2019-09-25 at 6.52.59 AM.png

      rwx තුනම file එකේ පෙන්නනවා කියන්නේ එ file එකට read write execute කියන permission තුනම දීල තියෙනව් කියන එක.

      මේ වගේ set 3ක් එක ෆයිල් එකක තියෙනව එ මොනාද ඒ
      පලව්වෙනි සෙට් එක - ෆයිල් එක හදපු එක්කෙනාට තියෙන permisson (owner of the file )
      දෙවනි සෙට් එක - file එකට access තියෙන membersලට දෙන permission
      තුන්වෙනි සෙට් එක - අනිත් usersලට තියෙන permission

      posted in Linux
      binurayeshan
      binurayeshan
    • DECISION MAKING IN SHELL SCRIPTS(Write a shell script to determine whether a given number is either positive or negative)

      මම අද ඔයාලට කියල දෙන්නෙ කොහොමද shell scripting පාවිච්චි කරල DECISION MAKING simple programme එකක් ලියන්නෙ කියල.:male-technologist:

      මේ link වලින් ගිහින් ඔයාලට bash script ගැන කලින් කරපු post බලාගන්න පුලුවන්..

      Lets talk about bash script - https://lankadevelopers.com/topic/371/lets-talk-about-bash-script

      First bash script - https://lankadevelopers.com/topic/372/first-bash-script

      Sum of two numbers in bash script - https://lankadevelopers.com/topic/377/sum-of-two-numbers-in-bash-script

      Bash script Array introduction - https://lankadevelopers.com/topic/386/bash-script-array-introduction

      ඔයාලට කියල දුන්න විදියට .sh File එකක් හදාගන්න. දැන් ඔයාලා මෙන්න මේ code එක ඔයාලගෙ script එකේ ලියන්න.

      #!/bin/bash
      
      echo "Enter mark :" 
      read number #ඔයාගේ mark එක read කරනව 
      
      if [ $number -lt 0 ]# මේ කියන්නෙ enter කරපු mark එක less than(අඩුයිනම්) 0 ට වඩා
      then #එහෙනම්
      	echo "Negetive" #negative කියල print කරන්න
      
      elif [ $number -gt 0 ] # මේ කියන්නෙ enter කරපු mark එක greater than(වැඩියිනම්) 0 ට වඩා
      then #එහෙනම්
      	echo "Positive"  #Positive කියල print කරන්න
      
      else #ඒ දෙකම නෙමෙයිනම් 
      	echo "Neither Positive nor negative" 
      fi
      
      

      :relaxed:
      0_1570151873514_Screen Shot 2019-10-04 at 6.47.49 AM.png

      posted in Linux
      binurayeshan
      binurayeshan
    • Simple linux commands for beginners

      මේ commands linux environment එකේ ඔයාලට භාවිතා කරන්න පුලුවන්

      uname -a 	 #used to print the system information
      uname -r	#Print the kernel release 
      uptime	#Display the time since the last boot
      hostname	#Get host name 
      hostname -i	#Host name ip address
      last reboot	#Last reboot time
      date	#Date information
      cal	#Carlander information 
      w	#provides a quick summary of every user logged into a computer,
      whoami      #Display username of the current user 
      who	#display the users that are currently logged into your Unix computer system
      id 	#Print user id and group id information
      df -h	#Disk space information
      df -t	#Disk types 
      
      posted in Linux
      binurayeshan
      binurayeshan
    • change read write execute permission of a file linux

      linux file permission ගැන දැන ගන්න - https://lankadevelopers.com/topic/382/understand-permission-of-a-file-in-linux
      හරි මම කියල දෙන්නම් දැන් කොහොමද linux file එකක permission වෙනස් කරන්නෙ කියල.

      0_1569376605126_Screen Shot 2019-09-25 at 6.46.17 AM.png

      මේ තියෙන්නෙ අපි හදා ගත්ත ෆයිල් එක sample.txt
      එයාට default permission විදියට ඇවිල්ල තියෙන්නෙ
      owner - read and write permission
      member - read only permission
      user - read only permission

      මම දැන් owner,group,user ඔක්ටකොටම මේ file එක execute කරන්න පුලුවන් විදියට permission දෙනව

      chmod +x sample.txt!
      

      0_1569376655050_Screen Shot 2019-09-25 at 7.24.19 AM.png

      දැන් ඔයා ඒ file එකේ permission බැලුවම ඔයාට පේනව් x කියල permission එක එයා​ලට හම්බුවෙලා තියෙනවා. ‍‍

      හරි දැන් අපි group membersලට permission දෙමු

      chmod g+w sample.txt # මේ කියන්නෙ group membersලට write permission දෙන්න කියල 
      

      0_1569376982177_Screen Shot 2019-09-25 at 7.31.30 AM.png

      ඔයාලට බලාගන්න පුලුවන්න් group membersලගෙ permission වෙනස් වෙලා තියෙන විදි​ය

      other usersලට permission දෙමු

      chmod o+w sample.txt
      

      0_1569377612870_Screen Shot 2019-09-25 at 7.43.20 AM.png

      ownerට විතරක් permission දෙමු

      chmod u+x sample.txt
      

      මේ විදියට ඔයාලට කැමති විදියට ෆයිල් වල permission දෙන්න පුලුවන්

      u — the user who owns the file (that is, the owner)
      g — the group to which the user belongs
      o — others (not the owner or the owner's group)
      a — everyone or all (u, g, and o)

      r — read access
      w — write access
      x — execute access

      posted in Linux
      binurayeshan
      binurayeshan
    • How to copy and move files on linux

      හරි මම අද ඔයලට කියල දෙන්නෙ කොහොම්ද Linux වලදි File එක​ක් copy කරගන්නෙ Move කරගන්නෙ කියල 0_1569455450299_Screen Shot 2019-09-26 at 5.20.41 AM.png

      හරි ඔයාලට පේනව මගෙ මේ ෆොල්ඩර් එක ඇතුලෙ sample.txt කියල file ekak තියෙනව මම දැන් කියල දෙන්නම් කොහොමද එකේ copy ගන්නෙ කියල වෙනත් නමකින්

      cp sample.txt new.txt #මේ කියන්නේ sample.txt කියන file එකේ copy එකක් new.txt කියල ගන්න කියලා.
      
      

      0_1569455747004_Screen Shot 2019-09-26 at 5.25.39 AM.png

      හරි දැන් බලමු කොහොමද හදපු file එක කොහොමද වෙන තැනකට move කාරග්න්නෙ කිය​ලා

      mv new.txt /Users/yeshan/Desktop/new.txt # මුලින්ම මම file එකේ නම දෙනවා ඊට පස්සෙ move කරන්න ඕන directory එකේ නම දෙනවා ඊට පස්සෙ ඔයාට කැමති නමක් දෙන්න පුලුවන් එත්කොට ඒ නමින් තමයි file එක move වෙන්නෙ..
      
      

      0_1569457230372_Screen Shot 2019-09-26 at 5.36.18 AM.png

      posted in Linux
      binurayeshan
      binurayeshan
    • Bash script Array introduction

      හරි මම ඔයාලට දැන් කියලා දෙනනෙ Bash script වල Array use කරන විදිය
      මේ link වලින් ගිහින් ඔයාලට bash script ගැන කලින් කරපු post බලාගන්න පුලුවන්..
      Lets talk about bash script - https://lankadevelopers.com/topic/371/lets-talk-about-bash-script

      First bash script - https://lankadevelopers.com/topic/372/first-bash-script

      Sum of two numbers in bash script - https://lankadevelopers.com/topic/377/sum-of-two-numbers-in-bash-script

      #!/bin/bash
      
      fruits=(apple orange graphes banana)
      echo "${fruits[2]}" #print element 2
      echo "${fruits[@]}" #print all array elements 
      echo "${!fruits[@]}" #print array position 
      echo "${#fruits[@]}" #calculate array size
      
      fruits[1]=lemon #overwrite 1st element 
      echo "${fruits[@]}"
      
      fruits+=(orange) #add more value (අපිට පුලුවන් මේකෙන් array එකේ element වැඩි කරන්න)
      echo "${fruits[@]}" #print all array elements
      echo "${!fruits[@]}" #print array position
      

      0_1569460696930_Screenshot from 2019-09-26 06-47-45.png

      posted in Linux
      binurayeshan
      binurayeshan
    • File Test Operators(bash script use කරල file එකක් හදල permission දීල run කරමු)

      හරි මම ඔයාලට කියල දෙන්නෙ මේ වෙනකන් කියල දීපු හැම පොස්ට් එකකින්ම ගත්ත දේවල් එකතු කරල කොහොමද linux වලදි එක ස්ක්‍රිප්ට් එකකින් ෆයිල් එකක් හදල ඒක ඇතුලෙ දෙයක් type කරල ඒකට execute permission දීලා ඒක run කරන්නෙ කියලා.

      හරි දැන් ඔයාල මෙන්න මේ වගේ sh file එකක් හදාගෙන script එක ලියන්න.

      #!/bin/bash
      
      cd ~ #මේ කියන්නෙ ඔයා ඉන්න directory එකෙන් ඊට කලින් තිබ්බ directory එකට යන්න කියල  මම මේ ඉන්නෙ Documents Directory එකේ තියෙන folder එකක ඒ නිසා මම මගේ User Directory එකට යන්න දෙපාරක් back වෙන්න ඕන  
      cd ~ # මේ දෙවනි එක 
      
      cd Desktop# හරි මම දැන් ඔන්න Script එකේ ලියනවා Desktop Directory එකට එන්න කියල 
      
      if [ -d new ] #මේ කියන්නේ new කියල Directory එකක් තියෙනවද කියල බලන්න කියන එක 
      then
      	echo "Directory available" #එහෙම තියෙනවනම් Directory available කියල display කරන්න
      	cd new #තියෙනවනම් ඒක ඇතුලට යන්න 
      else 
      	echo "Directory not available so i am creating file.."#එහෙම නැත්නම්not  Directory available කියල display කරන්න
      	mkdir new#Directory එක හදන්න
      	cd new#දැන් ඒක ඇතුලට යන්න
      fi #එක decision making command set එකක් ඉවරයි
      
      if [ -f foo.sh ] #හරි දැන් බලන්න foo.sh කියල file එකක් තියෙනවාද කියල 
      then 
      	echo "File available"#එහෙම තියෙනවානම් File available කියල print කරන්න 
      else
      	echo "File not available so i am creating file..." #එහෙම නැත්නම් File not available so i am creating file..." කියල print කරලා
      	touch "foo.sh"; echo "#!/bin/bash" >> foo.sh #File එක හදන්න හදලා ඒකෙ #!/bin/bash කියල type කරන්න කියන්න 
      fi
      
      if [ -e foo.sh ] #හරි මේ බලන්නෙ ඒ හදපු ෆයිල් එක ඇතුලෙ text මොනවා හරි තියෙනවාද කියල
      then 
      	echo "available"# එහෙම තියෙනවානම් available කියල print කරන්න 
      else
      	echo "Not available so i am writing.." #එහෙම නැත්නම් 
      	echo "#!/bin/bash" >> foo.sh##!/bin/bash කියල ෆයිල් එක ඇතුලෙ ටයිප් කරන්න 
      fi
      
      if [ -x foo.sh ]#මේ කියන්නෙ ඒ හදපු ෆයිල් එකට execution permission දීලද බල්න්න කියල 
      then
      	echo "Yes executable file so i am opening file"#එහෙම දීලනම්
      	open foo.sh#open කරන්න 
      	./foo.sh#Execute කරන්න 
      else
      	echo "Not a executable file i give permission and opening file"#file එකට permission දීල නැත්නම් 
      	chmod +x foo.sh #permission දෙන්න 
      	open foo.sh
      	./foo.sh
      fi
      
      echo "enter yes if you want edit file otherwise enter no" # හරි මම දැන් කියනවා ඔයාට ඒ file එක ආයිත් edit කරන්න ඕනනම් yes කියල type කරන්න එපානම් No කියල ටයිප් කරන්න 
      read input #user ගේ input එක ගන්න 
      
      if [ "$input" = "yes" ] # input එක yes නම් 
      then
      	open foo.sh # ෆයිල් එක open කරන්න 
      else 
      	echo "Work done bye!!!!" 
      fi
      
      

      :alien:

      0_1570411209941_Screen Shot 2019-10-07 at 6.50.04 AM.png

      posted in Linux
      binurayeshan
      binurayeshan
    • Simple linux commands for beginners part 2

      ලින්කුව for part 1 - https://lankadevelopers.com/topic/380/simple-linux-commands-for-beginners

      echo ”$SHELL”	 #අපි පාවිච්චි කරන ශෙල් එක බලන්න පුලුවන්
      echo ”$SHELL_VERSION”	#Check where the bash is located 
      pwd	#Current directory එකේ path එක බලන්න පුලුවන්
      echo ”Hello world”	#Print Hello world 
      cd Desktop	#Change current directory 
      d -	#Moving directory up by one level
      cd ~	#Go to Home directory
      ls 	#List out the directory content
      ls -al	#Get more information about file with access permission 
      ls -a	#list the all file including hidden files 
      rm sample.txt #file එකක් delete කරන විදිය 
      rm -d newfolder #directory එකක් delete කරන විදිය 
      .filename.extension	#Hidden the file (ෆයිල් එකේ නමට ඉස්සරහින් . එකක් තියන්න )
      ``
      posted in Linux
      binurayeshan
      binurayeshan
    • Read only variables in Bash Scripting

      මේ link වලින් ගිහින් ඔයාලට bash script ගැන කලින් කරපු post බලාගන්න පුලුවන්..

      Lets talk about bash script - https://lankadevelopers.com/topic/371/lets-talk-about-bash-script

      First bash script - https://lankadevelopers.com/topic/372/first-bash-script

      Sum of two numbers in bash script - https://lankadevelopers.com/topic/377/sum-of-two-numbers-in-bash-script

      Bash script Array introduction - https://lankadevelopers.com/topic/386/bash-script-array-introduction

      මොකක්ද මේ කතාව හරි මෙන්න මෙහෙමයි.
      අපි Bash Script එකක් ලියනකොට අපිට ඕනි වෙනව වෙනස් කරන්න බැරි විදියට variables හදන්න ඒ කිවුවේ මෙන්න මෙහෙම.
      හිතන්නකො මම මුලින්ම x = 5 කියල value එකක් දෙනව කියල මම ඊලග code line එකේ x=8 කියල දුන්නම x ගේ value එක 8 ක් වෙනවා

      x=5
      echo "$x"
      
      x=8
      echo "$x"
      
      

      මෙන්න මේ වැඩේ අපිට නතර කරගන්න පුලුවන් readonly variable use කලාම. ඔන්න බලන්න ඒක කරන විදිය

      #!/bin/bash
      
      readonly x=5 #අපි x ව readonly variable එකක් කලා
      echo "$x"#එයාව print කරනවා
      
      x=9 #ඔන්න දැන් එයාව වෙනස් කරන්න හදනව  ඒ නිසා අපිට පෙන්නනව එයාව වෙනස් කරන්න බෑ කියල 
      echo "$x"
      

      0_1569543892668_Screen Shot 2019-09-27 at 5.53.00 AM.png

      posted in Linux
      binurayeshan
      binurayeshan
    • unsert variables in Bash Scripting

      මේ link වලින් ගිහින් ඔයාලට bash script ගැන කලින් කරපු post බලාගන්න පුලුවන්..

      Lets talk about bash script - https://lankadevelopers.com/topic/371/lets-talk-about-bash-script

      First bash script - https://lankadevelopers.com/topic/372/first-bash-script

      Sum of two numbers in bash script - https://lankadevelopers.com/topic/377/sum-of-two-numbers-in-bash-script

      Bash script Array introduction - https://lankadevelopers.com/topic/386/bash-script-array-introduction

      Read only variables in Bash Scripting - https://lankadevelopers.com/topic/387/read-only-variables-in-bash-scripting

      අපි දැන් බලමු මොකක්ද මේ unset variables කියල කියන්නෙ කියල.
      මෙන්න මෙහෙමයි
      හිතන්න අපි මුලින්ම assign කරපු variable එකක value එක පස්සෙ අයින් කරන්න ඕනි කියල අපි මේකට use කරන්නෙ unset variables

      #!/bin/bash
      
      y=7 #y ගේ value එක 7 යි කියල දෙනව
      echo "$y" #ඒක ප්‍රින්ට් කරනවා
      
      unset y #ඔන්න දැන් value එක අයින් කරන​වා
      echo "$y" #දැන් ප්‍රින්ට් කරල බල්න්න...
      

      0_1569544638776_Screen Shot 2019-09-27 at 6.07.08 AM.png

      posted in Linux
      binurayeshan
      binurayeshan
    • Arithmetic operators in BASH scripting

      අද කතා කරන්නේ Basic Arithmetic operators ටික ගැන. ඒ කියන්නෙ එකතු කිරීම, අඩු කිරීම , බෙදීම , ගුන කිරීම.

      ඔයාල දැන් දන්නවනේ කොහොමද bash script file එකක් හදාගන්නෙ කියල.. දන්නෙ නැති අය මෙ Link එක Use කරල ඔක්කොම ටික බලන්න - https://binurayeshan.blogspot.com

      හරි දැන් ඔයාලා හදා ගත්ත script file එකේ මෙන්න මේ code line ටික type කරන්න.

      #!/bin/bash
      
      a=2
      b=5
      c=9
      
      echo "$a,$b,$c"
      
      echo "Sum of variable are = $[a+b+c]" #එකතු කිරිම්
      
      echo "Value of c MOD b = $[c%b] " #mod එක ඒ කියන්නෙ බෙදුවම එන ඉතිරිය
      
      echo "Value of c MOD b = $[c-b] " #අඩු කිරීම
      
      echo "Value of a * c = $[a*c]" #ගුණ කිරීම
      
      echo "Value of c / b = $[c/b]"  #බෙදීම
      
      

      :male-technologist: :sunglasses:
      0_1570406256663_Screen Shot 2019-10-07 at 5.27.33 AM.png

      posted in Linux
      binurayeshan
      binurayeshan
    • home brew install කරනොකට මම face කරපු issue එකක් තමා මේ. මම ඒකට හොයාගත්ත solution එක තමා මේ. කාට හරි වැදගත් වුනොත් use කරන්න. brew install and brew update hang with error: 'refs/remotes/origin/master': unknown revision or path not in the working tree.

      brew install and brew update hang with error: 'refs/remotes/origin/master': unknown revision or path not in the working tree.

      මේ lines දෙක use කරන්න.

      rm -fr $(brew --repo homebrew/core) # because you can't brew untap homebrew/core
      brew tap homebrew/core

      posted in System & Network Configurations
      binurayeshan
      binurayeshan
    • python automation සිංහලෙන් ඉගෙන ගමු..

      හරි මම ඔයාලට අද අරගෙන ආවේ පයිතන් automation මුල ඉදල සරලව සිංහලෙන්.. ඉගෙන ගන්න කැමති අය මේ වීඩියෝ එක බලන්න.. අඩු පාඩු කියන්න..

      build your python environment - https://youtu.be/ZSeSU2kUx8E

      alt text

      posted in AI Programming
      binurayeshan
      binurayeshan
    • DECISION MAKING IN SHELL SCRIPTS Part 2(කොහොමද Arguments දෙකක් එක්ක වැඩ කරන්නෙ)

      හරි මම ඔයාලට කියල දෙන්නම් කොහොමද conditions දෙකක් check කරන්නෙ කියල.
      මෙන්න මේකයි Programm එක. userගෙන් input දෙකක් ගන්නව අරගෙන එයා ඒ දෙකටම inputs දුන්නද නැද්ද කියල check කරනව.

      #!/bin/bash
      
      echo "Enter argument 1 :" #argument 1 එක එන්ටර් කරන්න කියනවා
      read arg1 #User ගෙන් input එක ගන්නවා
      
      echo "Enter argument 2 :"
      read arg2
      
      if [ -n "$arg1" ] #මේ කියන්නෙ arg1 එක මෙකේ value එක Zero නෙමේනම් කියන එක 
      then #එහෙමන්ම්
      	echo "Argument 1 has value"#Argument 1 has value කියල print කරන්න 
      
      elif [ -z "$arg1" ]#මේ කියන්නෙ arg1 එක මෙකේ value එක Zero නම් කියන එක 
      then #එහෙමන්ම්
      	echo "Argument 1 has no value"#Argument 1 has no value කියල print කරන්න
      fi#මේ කියන්නෙ මෙන්න මේ පටන් ගත්ත පලවෙනි dicision එක close කරන්න කියල 
      
      if [ -n "$arg2" ]
      then
      	echo "Argument 2 has value"
      
      elif [ -z "$arg2" ]
      then 
      	echo "Argument 2 has no value"
      fi
      

      :male-technologist: :call_me_hand: :sunglasses:

      0_1570345984519_Screen Shot 2019-10-06 at 12.42.59 PM.png

      මේ link වලින් ගිහින් ඔයාලට bash script ගැන කලින් කරපු post බලාගන්න පුලුවන්..

      Lets talk about bash script - https://lankadevelopers.com/topic/371/lets-talk-about-bash-script

      First bash script - https://lankadevelopers.com/topic/372/first-bash-script

      Sum of two numbers in bash script - https://lankadevelopers.com/topic/377/sum-of-two-numbers-in-bash-script

      Bash script Array introduction - https://lankadevelopers.com/topic/386/bash-script-array-introduction

      posted in Linux
      binurayeshan
      binurayeshan
    • Logical Operators in bash script(And, OR, NOT)

      හරි මම ඔයාලට කියල දෙන්නම් අද කොහොමද BASH Script වලදි Logical expression use කරන්නෙ කියලා..

      #!/bin/bash
      
      echo "Enter marks :"#user ගෙන් input එක ඉල්ලන්න
      read mark #input එක ගන්න 
       
      if [ $mark -ge 80  -a $mark -le 100 ] #enter කරපු mark එක 80ට වඩා වැඩිද(-ge 80) ඒ වගේම (-a) 100ට වඩා අඩුද(-la 100)
      then #එහෙමනම් 
      	echo "A" #A කියල print කරන්න 
      elif [ $mark -ge 60 -a $mark -le 79 ]
      then 
      	echo "B"
      elif [ $mark -ge 40 -a $mark -le 59 ]
      then 
      	echo "C"
      elif [ $mark -ge 20 -a $mark -le 39 ]
      then 
      	echo "D"
      elif [ $mark -ge 10 -a $mark -le 19 ]
      then 
      	echo "E"
      else
      	echo "Invalid mark"
      fi
      
      

      :ghost:

      0_1570683194188_Screenshot 2019-10-10 at 10.23.09.png

      posted in Linux
      binurayeshan
      binurayeshan
    • 1 / 1