Understanding Variables on the Linux Command-Line

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

КОМЕНТАРІ • 37

  • @sidheart8905
    @sidheart8905 9 місяців тому +2

    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.

  • @Akaterial
    @Akaterial 9 місяців тому +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.

  • @12Q46HPRN
    @12Q46HPRN 10 місяців тому +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!

  • @Xenonandplutonium
    @Xenonandplutonium 10 місяців тому +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.

  • @lorensims4846
    @lorensims4846 10 місяців тому +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!

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

    Amazing explanation, thank you!

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

    Thanks

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

    Thank you.

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

    Thank You...

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

    Another great episode

  • @bramfran4326
    @bramfran4326 10 місяців тому +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 9 місяців тому +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 8 місяців тому

    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.

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

    Thank you

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

    Thanks!

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

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

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

    Subscribed !

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

    What ur font name please?,

  • @lachidong7818
    @lachidong7818 12 днів тому

    what text font is this ?

  • @x91w
    @x91w 10 місяців тому +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 10 місяців тому

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

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

    good video

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

    Nice video , did not know about sub shell

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

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

    • @tschorsch
      @tschorsch 10 місяців тому +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.

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

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

    • @gumse666
      @gumse666 10 місяців тому +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 10 місяців тому

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

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

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

    👏👏👏

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

    👍

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

    Sir add some videos with no-ip server setup

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

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

    • @teecount1
      @teecount1 10 місяців тому +1

      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 10 місяців тому

      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 9 місяців тому

    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 10 місяців тому

    Thanks