Bash Scripting for Beginners: Complete Guide to Getting Started - Data Streams (Part 11)

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

КОМЕНТАРІ • 43

  • @jim7smith
    @jim7smith 2 роки тому +45

    Been using Linux for about 15 years, and this is the best tutorial on scripting I have ever seen. Excellent work, Jay.

  • @VIXochaP
    @VIXochaP Рік тому +13

    Thanks!

  • @whyYUbee
    @whyYUbee 7 місяців тому +3

    The best study for someone with ADHD! I learn so much, so quick, it's crazy! Thank you so much Jay 🙏

  • @NorwegiansCantCook
    @NorwegiansCantCook 2 місяці тому

    Thanks

  • @jaredlara2850
    @jaredlara2850 2 роки тому +3

    I’m a junior in college and have never been taught this. This explains so much. Thanks Jay you dah man🤘🏼🤘🏼

  • @EdnovStormbrewer
    @EdnovStormbrewer 2 місяці тому

    Thank you for the video. Probably one of the best ones I've seen so far.
    However, it's not a good idea executing the script while logged in as root for /var/log. There is a much safer alternative which is logging files right where the universal updater script is as user. Other than that, keep up the great work.

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

    Knowing about data streams is very important because sometimes some programs have very unexpected behavior regarding them. A very good example of this is the tool for creating menus "dialog", which outputs collected data to standard error by default.

  • @ShamleThilaksiri
    @ShamleThilaksiri 8 місяців тому

    This is by far the best bash scripting tutorial. Thanks a bunch for the free knowledge.

  • @tengdayz2
    @tengdayz2 7 місяців тому

    I feel like I'm learning Linux the right way from your guide. Thanks for sharing your Linux Expertise.

  • @future-jim
    @future-jim Рік тому +3

    The reason I find this video series so insightful is because it provides real-world examples of how and why you'd use the scripts/commands.
    Most other bash scripting tutorials show you every permutation of commands and parameters without any useful context.

  • @kamaleeswarisrinivasan8273
    @kamaleeswarisrinivasan8273 4 місяці тому +1

    Thank you sir keep growing

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

    I've paid money for longer less helpful programming sessions. Thanks for the information and tutorials!! You're great at this!!!

  • @ericablack1847
    @ericablack1847 Рік тому +1

    Excelent work
    You are a very good teacher
    You are a master !

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

    I am having so much fun with this series! Thank you Jay

  • @emoutraspalavras-marloncou4459

    Thank you so much for your time and great tutorial. I have only a question: why is it written in the update script like: "if [ $? -ne 0 ] ...." instead of "if [ $? -eq 2 ] ....."? What would be the difference?

    • @draufunddran
      @draufunddran Рік тому +5

      The difference is that in the first case where the check is for "$? -ne 0" you will get the error message printed on ANY error code other than 0, even 3 and 4 and basically every other exit code that is possible. In the second case with the check for "$? -eq 2" you will only see the error message printed when the actual error code is 2. Most programs have different error codes for different errors. For example there "ls" command returns either 1 or 2 as an error code depending on the error type. I hope this explains it a bit better. To summarize again, you want the message to appear no matter the actual error code is a long as its not the success code which is 0.

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

    it s entertaining watching your videos, extremly skilled.

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

    Wow! You made the entire bash scripting look facile. Thank you Jay 🤝

  • @ChimiChuri-k2o
    @ChimiChuri-k2o 2 місяці тому

    23:00 that is soo cool :D

  • @mihai6564
    @mihai6564 Рік тому +1

    good video. I even bought a faster Internet to watch it in better quality.

  • @sergiosinanis
    @sergiosinanis 5 місяців тому

    Thanks a lot Jay, just a question, when you re-write the universal update script with the three variables do you actually create two new files (the updater.log and the updater_errors.log) ? Or do they already exist in the system ? Because I thought that in order to create a file you need the touch command 😅 thanks !

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

    Very useful tutorial

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

    thank you for teaching us.

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

    Great examples to understand stout and stderr, and how to redirect them to file. Unfortunately, this concept cannot be easily used for piping stderr to grep, for example. I find that extremely strange.

  • @JoaoPaulo-ox6pr
    @JoaoPaulo-ox6pr Рік тому +1

    So, now the penny has dropped.
    Those libraries for log management like Winston on JS use data streams to redirect the console output to a file? Why did I take so much time to realize this?
    I knew Data streams, before this bash course, when i was learning coding with python(first language), and thought that was only useful for command line utilities, but now, with a little more knowledge, i can see so many use cases for this.

  • @Eilay_Yosfan
    @Eilay_Yosfan 5 місяців тому

    Thank you

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

    can anyone tell what is this "apt does not have a stable CLI interface. Use with caution in scripts" ?

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

    Thanks

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

    👍Thanks!

  • @KapilSharma-co8xq
    @KapilSharma-co8xq Рік тому

    If 1 is the exit code for standard output then how come we get exit code 0 after echo.

    • @MrUwU-dj7js
      @MrUwU-dj7js Рік тому

      I think you are confusing things. 0 is exit code for succesful commands, and !=0 is exit code for unsuccesful commands. 1 and 2, on the other hand, is the data stream code used to represent standar output and err, which can be independent to exit codes.
      That is, you can have something with standar errs, but the command can be run succesfully.
      An example would be sudo apt install notexist1 notexists2 notexist3 htop. This will output some standar errs, as there is no package notexists, but apt will still be able to succesfully run this command, as htop can be installed, and this part will be print as standar output. So the command itself is succesfull, despite printing some (not all) standard errs.
      Another example is the one with "find" in the video. The command did not fail, so exit code is 0. But, a bit of the information printed was standar errs. In short, command was succesful (exit code 0), despite there being some standar errs (data stream code 2).
      Note: Take my interpretation with a grain of salt.

    • @KapilSharma-co8xq
      @KapilSharma-co8xq Рік тому

      @@MrUwU-dj7js Thanks for such illustrated explanation.

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

    what stands for tail -f? tail is just last rows.. but what is -f

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

    Note :
    Cmd 1 > file1.txt is equivalent to Cmd > file1.txt
    &> means sending both stdin and stderr

  • @rohansirohi8335
    @rohansirohi8335 7 місяців тому

    me who already added -y before you said lol 😂

  • @ХайлайтыДлиннойВоли

    You might want to add `--noconfirm` flag for pacman to run silently.

  • @MyAccount-o5c
    @MyAccount-o5c 4 місяці тому

    Хороший материал

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

    i thought 0> would show it :c

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

    1000th ✌

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

    Debug script with root permissions... hmm..smart

  • @Vo0idsEmbrace
    @Vo0idsEmbrace 6 місяців тому

    everything in /dev/null is never seen from or heard from again...