Command Substitution: Can you return data instead of exit codes in Bash? | #3 Practical Bash

Поділитися
Вставка
  • Опубліковано 27 січ 2025

КОМЕНТАРІ • 14

  • @bernhardkern629
    @bernhardkern629 4 роки тому +6

    yay, my first youtube comment, just to tell you that your video series is great. Watched the https/tls video and landed in your bash series.

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

      Thanks! I feel honored to receive your first ever youtube comment :-)

  • @ernestogutierrez7877
    @ernestogutierrez7877 3 роки тому +1

    Had I known function return statements where meant for returning exit codes (0-255) back when I started coding bash scripts, I would have saved myself a lot of troubleshooting time :S
    Great video mate!

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

    This series is awesome. Thanks !

  • @blank-vw2sb
    @blank-vw2sb 3 роки тому

    Love the series. Thanks!!

  • @jamesw6949
    @jamesw6949 5 років тому +3

    Introduced me to shellcheck, thanks!

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

      And you just gave me the idea to create a video about shellcheck. Thanks :)

    • @jamesw6949
      @jamesw6949 5 років тому

      @@kubucation :)

  • @loveanimals-0197
    @loveanimals-0197 4 роки тому +2

    What if you had multiple echo statements within that called function?

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

      All output that is usually sent to stdout would be caught. A single or multiple echo statements don't make a difference. We only see an echo statement as a "unit" because it automatically appends a new line (
      ) at the end of the line. However, that's just a default setting and you can in fact not add a new line by using "echo -n foo". Similarly the new line would just be caught by the command substitution along with the remaining output.

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

    Hi, this is one of the weird things I took time to understand. Actually, bash shouldn’t be compared to other languages (data types). Bash was supposed to run external binaries/commands that do their stuff and binaries don’t need to play with return values of other binaires. Nice video btw

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

    thanks, very understandable

    • @kubucation
      @kubucation  5 років тому

      thanks a lot, very glad to hear :)

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

    part 3?