Lanka Developers Community

    Lanka Developers

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

    Read only variables in Bash Scripting

    Linux
    bash scripting linuxfoundation linux
    3
    3
    512
    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

      මේ 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

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

        superb bro

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

          good work bro

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

          0
          Online

          3.7k
          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

          | |