Python or Bash for scripting? Which is best?

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

КОМЕНТАРІ • 27

  • @CurrentElectrical
    @CurrentElectrical 6 місяців тому +3

    You may never use it again (you first program), but it did two things- 1. it taught me how useful it can be- long term (30+ years!) and it was an excellent learning experience for you. Keep up the fantastic vids. Thank you!
    As a request/ suggestion for comparison between bash and python: why not write the equivalent of the first program in bash you wrote in python? Maybe even do a live so we can all learn along with you teaching us? Now that would be awesome!

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

    I wish there were an easy way to utilize bash functions inside awk. But bash is only for anything less than 25 lines/25 minutes.

  • @samarnagar9699
    @samarnagar9699 Рік тому +4

    i made an bash script to run the last saved file and choose the compiler or interpeter based on files language and it gave me strokes like bash syntax is hell

  • @NiceMicroTV
    @NiceMicroTV Рік тому +2

    Writing anything in Bash is a nice exercise, but I'd say it only makes sense if you're really rely on calling programs.
    Bash is a shell, Bash scripting is for shell scripting, so, you put together stuff in it that you'd be doing in your shell anyways. Like, I do my backups with a Bash script that calls rsync with a specific set of parameters and then rotates old backups using mv and rm.
    If you need to have many variables (especially arrays, holy cow), and adding together numbers and operations like that, then you go with something else, than shell scripting.

  • @johanngambolputty5351
    @johanngambolputty5351 Рік тому +4

    I've been using python in place of some bash scripts lately (for bspwm/rofi scripts). It is nice being able to go back and be able to read things... For instance for your feh/dmenu example you could:
    ```
    from subprocess import getoutput as go
    WALLPATH="~/pictures/wallpapers"
    wallpaper = go(f"ls {WALLPATH} | dmenu -i -l 50")
    if wallpaper != "": go(f"feh --bg-fill {WALLPATH}/{wallpaper}")
    ```

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

      Piping from ls isn't safe, but nice to know that using subprocess is a viable option to chaining commands

  • @yoga9869
    @yoga9869 7 місяців тому +1

    aku mulai tertarik disaat python lebih fleksible namun aku sering terkendala environment dan modul disaat saya menggunakan mesin lainnya

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

    Using the terminal, automating stuff with bash scripting and having bash run python scripts for more complex stuff has single handedly changed my computing life. I'm surprised it isn't more commonplace, and those that do it don't use it as effectively. With this you can literally take any complex thing and have it done in a few seconds without the overhead of a gui or cli.

  • @LeoNux-um7tg
    @LeoNux-um7tg 6 місяців тому

    how about powershell?

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

    How about a Python module that implements bash commands? I was thinking of creating one just for fun, but that might actually be useful to other Linux/MacOS users. And maybe implement a batch backed for windows users.

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

      do you even ansible

  • @barry5
    @barry5 Рік тому +4

    clearly, the best scripting language is vbscript for internet explorer

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

      Mercy. I never understood what a trigger word was until i read this comment.

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

    Definitionly Bash, as it is widely available on all Unix-like systems, not everyone has a full control of your environments.

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

    Most Linux tools such as the GNU Core utils (e.g: mkdir, cat) are written in C, having the benefits of it being fast and also portable is honestly pretty nice. C isn't too hard to learn either, although it'll depend on the complexity of the application you're writing.

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

    What ide are you using?

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

      he is using a text-editor called NeoVim

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

    Now do a real head scratcher. Perl vs Python for unix system administrators?

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

    👍Love your video Young Jeti🙏 🤣 You find Python counter intuitive? I need your dictionary, please. I'm not a coder, just a writer learning from you for fun. I thought Python was for web design? But I know nothing of computer script writing. Teach us bash scripting, please.

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

    oh a fello nvchad enjoyer

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

    Good job!

  • @R3DC0DE
    @R3DC0DE Рік тому +2

    Just coming here to say Lua

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

      Never tried it!

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

      ​@@MashedLinux same, but still I use neovim (AstronNvim) without learning lua😏

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

    Ohh ! Obviously bash script.

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

    rust best for scripting

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

    I disagree. Imagine that.