Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Shop

    Bash script Array introduction

    Linux
    bash scripting linux
    3
    5
    1393
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • binurayeshan
      binurayeshan Linux Help last edited by binurayeshan

      හරි මම ඔයාලට දැන් කියලා දෙනනෙ 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

      1 Reply Last reply Reply Quote 3
      • dev_lak
        dev_lak last edited by

        thanks bro..

        binurayeshan 1 Reply Last reply Reply Quote 1
        • root
          root Linux Help last edited by

          bro can you link all bash posts together

          binurayeshan 1 Reply Last reply Reply Quote 0
          • binurayeshan
            binurayeshan Linux Help @root last edited by

            @root Its good idea brother, thank you..

            1 Reply Last reply Reply Quote 0
            • binurayeshan
              binurayeshan Linux Help @dev_lak last edited by

              @dev_lak Thank you...

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post

              0
              Online

              3.6k
              Users

              1.3k
              Topics

              5.3k
              Posts

              • Privacy
              • Terms & Conditions
              • Donate

              © Copyrights and All right reserved Lanka Developers Community

              Powered by Axis Technologies (PVT) Ltd

              Made with in Sri Lanka

              | |