Shell Scripting Tutorial for Beginners 14 - Array variables

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 33

  • @ruthlessdraculigula1051
    @ruthlessdraculigula1051 2 роки тому +8

    Even if you're treating a variable as an array, you can still get the number of characters in the variable by typing
    _echo "${__#string__[0]}"_
    which will display the exact number of characters in your string, as opposed to the shell returning a "1" as normal.
    This channel is awesome, with lessons that are easy to follow; sub-freakin-scribed.

  • @LoloLolo-vv2pv
    @LoloLolo-vv2pv 4 роки тому +4

    I spent all days searching for a good tutorial and finally I find this....... Thxxxxxxxxxx A MILLION 🌹

  • @Trzbne
    @Trzbne 7 років тому +6

    I watched some videos of you from 2013 (uploaded 2 years ago), and have to tell, that your teaching skills improved a lot, your videos are more enjoyable and faster. Thank you very much for uploading new lessons!

  • @AJAYSHARMA-gb6qw
    @AJAYSHARMA-gb6qw 7 років тому +10

    thank you sir for guiding us you are the mentor for not only me but for all those who can't afford the better education by paying the money thank you this means a lot to me sirg

  • @khelifatoufik9331
    @khelifatoufik9331 7 років тому +2

    i stared learning programing fom u i mean c languge im gonna watch this in the coming summer god bless u

  • @seethad8057
    @seethad8057 6 років тому +1

    Hi Sir,The way you are presenting is awesome.Its very easy to understand.Thanks much :)

  • @GazbertUK
    @GazbertUK 4 роки тому

    Thanks for the video, had all the information I needed.

  • @unbekannter_Nutzer
    @unbekannter_Nutzer 3 роки тому

    Small note on numbers, indexes and ordinals (1st, 2nd, 3rd ...).
    Given the array `pets=(cat, kea, crocodile)`.
    The first index of the Array is 0. The Element at index 1 is "kea". It's the 2nd element of the array, but its index is 1. However it is the 2nd Index. The first index is zero.
    There is no such thing as an zeroth element. The 2nd element is at the second index, but the name of the index is 1. Which doesn't make it the first index. It's the index one.

    • @subhambairagi5642
      @subhambairagi5642 2 роки тому +1

      Or you can better put it in this way- index number means the distance of all subsequent elements in a list(or array) from the first element. Here, "cat" is your first element in list, so the distance of "cat" from "cat" is 0 (same element) and kea is 1 slot away from cat so it has index 1. Similarly, crocodile has index 2 and so on...

  • @rishavdas9410
    @rishavdas9410 Рік тому

    Very good tutorial

  • @letslearnaaoseekhay
    @letslearnaaoseekhay 5 років тому +1

    What is the maximum number of subscripts bash allows in Array? And how to increase that limit?

  • @RBLXANIMEEDITZ
    @RBLXANIMEEDITZ 7 років тому +1

    Good one for beginners

  • @divyanadar3569
    @divyanadar3569 4 роки тому +1

    How to take array input from user of a specific array size????

  • @erick5171
    @erick5171 2 роки тому

    how can i get manual page abouth these array variable features. man array does not returning manual page.

  • @jahabarali2953
    @jahabarali2953 Рік тому

    Great. 👏👍🏻

  • @Hackenbaker
    @Hackenbaker 3 роки тому

    Very clear 👌 👏

  • @AmanSingh-wx8jc
    @AmanSingh-wx8jc 7 років тому +1

    can we put any number as array element?

  • @allen6031
    @allen6031 6 років тому +1

    how to print the index of any array value from the given array...

  • @aishuasade4565
    @aishuasade4565 2 роки тому

    Good 👍👍🙂☺️

  • @ningarajtoranagatti266
    @ningarajtoranagatti266 4 роки тому +1

    Pls use white theme background

  • @Amir-kj1ks
    @Amir-kj1ks 3 роки тому

    Nice🔥

  • @ChaitanyaShar19
    @ChaitanyaShar19 3 роки тому

    I'm trying to take input value from User and then try to pass the value so that it can automatically print the value in the array :
    #! /bin/bash

    os=('kali','windows','ubuntu')
    echo -e "Enter the array pos"
    read arr
    echo "${os[$arr]}"
    Enter the array pos : 1
    the value i get is blank......
    how do I parse this value so that the array value can be returned ?

    • @valentin-catalin1859
      @valentin-catalin1859 3 роки тому

      8 months later but maybe it will still be useful to you or someone else:
      #! /bin/bash
      os=( windows ubuntu kali ) #spaces between elements not comma
      read -p "enter the item position: " arr
      echo "${os[$arr]}"

    • @ChaitanyaShar19
      @ChaitanyaShar19 3 роки тому

      @@valentin-catalin1859 Thank you! yes, you're correct. I figured it out later.

    • @shrikantsawant196
      @shrikantsawant196 2 роки тому

      @@valentin-catalin1859 how can i redirect read output to a file?

    • @valentin-catalin1859
      @valentin-catalin1859 2 роки тому

      @@shrikantsawant196 No sure what you want to do. In the example above with the os array you can just add another line to your script, echo $arr > my_new_file, or if you want to write something like argument number 2 is ubuntu, you can write echo "$arr is ${os[$arr]}" > my_new_file

  • @abrahimsatti2885
    @abrahimsatti2885 6 років тому +1

    Awesome

  • @tasniaiqbal578
    @tasniaiqbal578 4 роки тому

    it works without single quotation in array

  • @bhavyamathur211
    @bhavyamathur211 4 роки тому +1

    removing ubuntu with mac is blasphemy

  • @amparorod2000
    @amparorod2000 5 років тому +2

    Fail...

  • @akhilmunjolil9474
    @akhilmunjolil9474 6 років тому +1

    👌👌👌

  • @iveee-a212bojjalavanya5
    @iveee-a212bojjalavanya5 4 роки тому

    blurring the video by showing code and ouput