• Special variables
  • Linux: This Book Includes 4 Manuscripts. The Underground Bible to the unix operating System with Tools On Security and Kali Hacking to Understand Computer Programming, Data Science and Command Line




    Download 6,34 Mb.
    Pdf ko'rish
    bet171/203
    Sana10.01.2024
    Hajmi6,34 Mb.
    #134102
    1   ...   167   168   169   170   171   172   173   174   ...   203
    Bog'liq
    Linux This Book Includes 4 Manuscripts The Underground Bible

    Variable assignments
    Variable assignments are the assignment values that are used to give a value
    to the variable. 
    It works in the following way:
    variable name = variable value 
    You can insert a lot of data types in the variable value. Data types are the
    ones in which variables are defined. Some data types consist of integers,
    floating-point numbers, and even strings sometimes. 
    Here is an example that describes the assignment value: 
    sample = 22
    Special variables
    Special variables such as usnet can be used to delete a defined variable from
    the memory. In this, we can store the random memory management. 
    There are also special variables that start with a $ parameter. These
    variables can be used to define additional parameters that the system may
    require during the process execution or advanced shell analysis.
    Here is the example for some of the special variable commands with a $
    $dude = ' string'
    The biggest advantage of using special variables is that they can be easily
    filtered and aliased with the help of the character that is present at the
    beginning of the variable.
    Arrays
    The array is a famous data structure that is capable of holding multiple
    items of elements. Programming languages use a lot of arrays because they
    are easy to implement unlike other data structures like trees or graphs and


    also they are fast. Shell also supports arrays to input elements. In this
    section, we will discuss arrays in detail. 
    a) definition of array
    Normally arrays consist of a subscript that defines the number of the
    element along with the name of the array. 
    Here is the command for an array example:
    example[]
    b) Giving value to an array
    All elements that are present in an array can be given a value using the
    symbol. You can also give the value using the individual array assignment
    like as shown below 
    sample = “America”
    You can insert any data type in arrays just like variables and the use of
    arrays can be very essential when you are dealing with loops and
    conditionals with complex code in it. 
    You can even connect both arrays to get the desired results. This scenario is
    shown below for your better understanding: 
    sample[2] = value
    Constants
    As we all know already that constant means something that cannot be
    changed. Constant values exist always and can be used to explain values
    like pi that have a constant numerical value. Whenever you try to change
    this constant variable an error or warning will appear in front of the shell
    that says this cannot be possible. 
    Here is an example of the constant command: 
    pi = 3.142 7


    Namespaces
    We already have discussed variables in detail and namespaces mean that
    variables that are in a defined scope. These are created for a reason that
    whenever users try to create variables that are of similar type a conflict
    always occurs and makes things difficult to organize. 
    For this exact reason, namespaces are invented and are used to define
    citations and references which can be used multiple times in a shell
    interface or a shell script. 
    Here is an example that explains in detail about this concept: 
    Operators
    Operators are the most important regions of a scripting language. Operators
    can help to mix or change the variable values. As of the shell, programming
    goes there are a lot of operators that can be used. We will discuss some of
    them now in detail: 

    Download 6,34 Mb.
    1   ...   167   168   169   170   171   172   173   174   ...   203




    Download 6,34 Mb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Linux: This Book Includes 4 Manuscripts. The Underground Bible to the unix operating System with Tools On Security and Kali Hacking to Understand Computer Programming, Data Science and Command Line

    Download 6,34 Mb.
    Pdf ko'rish