Understanding Variables on the Linux Command-Line

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

КОМЕНТАРІ • 37

  • @sidheart8905
    @sidheart8905 11 місяців тому +3

    i am professional with 11 year experience but i still love your all videos and keep watching them daily the way you explain basics... just addicted for learning.

  • @BenChnobli
    @BenChnobli 11 місяців тому +1

    Thanks

  • @Akaterial
    @Akaterial 10 місяців тому +2

    Great video. I watched it last month when it was new. It came back to me as I was moving a bunch of files and directories around. Typing out directory names can be tedious even with autocomplete. I used what I learned in this video to create variables of the directory paths. It instantly made things so much easier. I could not only copy things around faster, I could also move around to the directories I stored in variables faster.

  • @Not-THAT-ChrisPratt
    @Not-THAT-ChrisPratt 11 місяців тому +6

    Outstanding!
    Thank you so much for your videos. I always learn something from you. I knew quite a bit about shell variables and even the env command. I've used the $(command) before, but more as a script-kiddie (copy/pasting what I've seen others doing online) and never knew that it opened up a sub-shell to run the command within the parentheses.
    Please keep up the good work!

  • @lorensims4846
    @lorensims4846 11 місяців тому +3

    Don't sweat the ALL CAPS. Many early computers (and in fact the first typewriter) used only all caps.
    Using lowercase or mixed-case letters tends to complicate things.
    Merry Christmas!

  • @Xenonandplutonium
    @Xenonandplutonium 11 місяців тому +2

    Pretty cool how I was learning about Python variables and you dropped this. This is cool. I feel like I can really get things more organized.

  • @TheGeekYT
    @TheGeekYT 11 місяців тому

    Thanks!

  • @Shocker99
    @Shocker99 11 місяців тому +1

    6:40 You should have ls'd a directory with something in it for this example.

  • @dylananderson7658
    @dylananderson7658 11 місяців тому

    Amazing explanation, thank you!

  • @bramfran4326
    @bramfran4326 11 місяців тому +3

    Why do newlines disappear inside the variable at 13:30? That does not seem very consistent, imagine if other things you don't know (obviously not normal characters??) could also disappear.

    • @IcarusSparry
      @IcarusSparry 11 місяців тому +1

      The newlines are still in the variable, except for the very last one. The problem I have with this video is that you always (except when you don't, but that is very rare) want to use variables inside double quotes. So if our host had used
      echo "$file_list"
      we would have seen the output in the way that was expected. To dive a little deeper, if the variable is used outside double quotes then it is split into words, and the echo command outputs each word it is given separated by a space. This also means that multiple spaces and tabs get removed, and then echo puts a single space back.
      msg="Hello World"
      echo $msg
      Hello World
      echo "$msg"
      Hello World
      Bash does have sub-shells, which are created with "(" and ")". The thing that is created with "$(" and ")" is a different concept called "command substitution".
      Whilst this is clearly an introductory video, I think that with a length of 18 minutes it could also mention arrays. The syntax for them is fairly horrible but they needed to be added in a reasonably backward compatible manner.

  • @zeppelinmexicano
    @zeppelinmexicano 10 місяців тому

    It should be interesting to see how this subshell-capture trick will work with some output more sophisticated than "ls" and all that. If it can actually capture htop in any meaningful way it would be handy to grab it for log purposes. Dunno, but there is a lot to test.

  • @juliusmilo5959
    @juliusmilo5959 11 місяців тому +1

    Thank You...

  • @k.chriscaldwell4141
    @k.chriscaldwell4141 3 місяці тому

    Thank you.

  • @brhend
    @brhend 11 місяців тому

    Thank you

  • @SnowDaemon
    @SnowDaemon 11 місяців тому

    Another great episode

  • @adrmantap6508
    @adrmantap6508 11 місяців тому +1

    What ur font name please?,

  • @currentfaves65
    @currentfaves65 4 місяці тому

    Subscribed !

  • @lachidong7818
    @lachidong7818 Місяць тому

    what text font is this ?

  • @Mister-Gee-9999
    @Mister-Gee-9999 11 місяців тому +3

    Is it OK to download say your bash course videos as a reference to use offline? If not where can I purchase a licence?

    • @ciscornBIG
      @ciscornBIG 11 місяців тому

      I've downloaded all learn Linux tv. UA-cam-dl

  • @ujjawalsinha8968
    @ujjawalsinha8968 11 місяців тому

    Why do we call Shell a "Shell". Is it because of the concept of "Sub-Shells"?

    • @tschorsch
      @tschorsch 11 місяців тому +4

      Because it's a shell around the OS, i.e. the outermost layer that a user interacts with. Shells can be command line or graphical.

  • @mihai6564
    @mihai6564 11 місяців тому

    good video

  • @pmpartners
    @pmpartners 11 місяців тому

    If I want a variable to be available every time I open bash, is there a way to persist them?

    • @gumse666
      @gumse666 11 місяців тому +4

      If you declare it in .bashrc it will be available in every new terminal session (you have start a new terminal after you add your command to se the variable)

    • @pmpartners
      @pmpartners 11 місяців тому

      @@gumse666 Thank you! I’ll give it a try.

  • @tanuj05
    @tanuj05 11 місяців тому

    Nice video , did not know about sub shell

  • @Shriramkrishnhari
    @Shriramkrishnhari 11 місяців тому

    👍

  • @majstorgile
    @majstorgile 11 місяців тому

    👏👏👏

  • @suhas_joshi
    @suhas_joshi 11 місяців тому

    Sir add some videos with no-ip server setup

  • @sotecluxan4221
    @sotecluxan4221 11 місяців тому

  • @ZubairKhan-vs8fe
    @ZubairKhan-vs8fe 11 місяців тому

    Please help. Why does Linux need a command line and a shell. Windows stopped using DOS ages ago

    • @teecount1
      @teecount1 11 місяців тому +2

      powershell on windows?
      To answer your question: It is usefull, if you do not want to do things yourself and want to have full control over the system.

    • @motoryzen
      @motoryzen 11 місяців тому

      Need? That depends
      If a program isn't launching at all or isn't launching correctly ( be it Linux , Mac, or Windows ) you can launch that program via a command prompt or terminal and you can then SEE....WHY.
      ;)
      Another scenario = a script that can completely setup and install all programs in your PC if you ever need to do a clean install ...starting over....and in the end..save literally...DAYS of work doing it all manually by hand.
      Instead...you'll end up doing it manually by hand.....once maybe twice..and make notes into the script.
      These are just a few of the many good scenarios where a command line and/or shell can be invaluable.

  • @palodoxaliqua5809
    @palodoxaliqua5809 11 місяців тому

    That path-variable had a / at the end. I therefore expected $mydir/hello.txt to have two / before the file name and throw an error because of the invalid path.
    Seems like linux ignores unnecessary slashes - interesting curiosity.

  • @theshowmanuk
    @theshowmanuk 11 місяців тому

    Thanks