• 3 Posts
  • 48 Comments
Joined 1 year ago
cake
Cake day: June 23rd, 2023

help-circle


  • Also you mentioned provisioning scripts, is that Ansible? If so python is already there, if you mean really just bash scripts I can tell you that does not scale well. Also if you already have some scriptsz what language are they on? Why not write the function there??

    Currently it’s mostly nixos, plus a custom thing that generates preconfigured openwrt images that I then deploy manually. I have a mess of other vms and stuff, but I plan to phase out everything and migrate to nixos (except the openwrt stuff, since nixos doesn’t run on mips).

    I don’t really need to run this specific synchthing-ID script except on my PC (I do the provisioning from there), but I have written scripts that run on my router (using busybox sh) and I was wondering if there is a “goto” scripting that I can use everywhere.


  • Elixir is quite big (yeah, it’s certainly smaller than something like java… sorry for not specifying what I mean by “small disk footprint”).

    Thats basically what ansible does. Thats basically what ansible does. If you plan on doing this to multiple machines you should just use ansible.

    Ansible requires python on the target machine (or a lot of extra-hacky workarounds) so… I could just use python myself :)

    BTW getting ansible to do anything besides the very straightforward usecases it was meant for is a huge pain (even a simple if/else is a pain) and it’s also super-slow, so I hate it passionately.

    Also how do you plan on ensuring the scripting interpreter is installed on the machines?

    Ideally I’d just copy the interpreter over via ssh when needed (or install it via the local package manager, if it’s available as a package)



  • Installing node uses some 60MB (according to zypper on my current desktop). I’d rather have something small and possibly that consists of a single executable.

    As a bonus, both support the vast and extensive NPM package repository

    That’s not necessarily a feature :) Package repos are great if you are a developer (I am one) working primarily with that language, but are frustrating if you just want to run things.



  • gomp@lemmy.mlOPtoLinux@lemmy.mlRecommend me a scripting language
    link
    fedilink
    arrow-up
    10
    arrow-down
    1
    ·
    7 days ago

    Why aren’t python and bash be available in all your systems?

    Among others, I run stuff on alpine and openwrt.

    I don’t need to run these scripts everywhere (strictly speaking, I don’t need the homlab at all), but I was wondering if there’s something that I can adopt as a default goto solution without having to worry about how each system is packaged/configured.

    As for python, I doubt the full version would fit in my router plus as said I don’t want to deal with libraries/virtualenvs/… and (in the future) with which distro comes with python3 vs pyton4 (2 vs 3 was enough). Openwrt does have smaller python packages, but then I would be using different implementations on different systems: again something I’d rather not deal with.

    As for perl, it would be small enough, but I find it a bit archaic/esoteric (prejudice, I know), plus again I don’t want to deal with how every distro decides to package the different things (eg. openwrt has some 40+ packages for perl - if I were doing serious development that would be ok, but I don’t want to worry about that for just some scripts).










  • beware fish shell syntax works drastically differently from other POSIX shells

    Come on, that’s scaremongering :)

    On interactive, day-to-day use, fish syntax is basically the same as bash or any other shell: you type your commands, hit enter and the command is run. Only when it comes to scripting (or writing complex one-liners, or copy-pasting stuff from the web) are there appreciable differences. In those cases, until one is accustomed to fish, running the command/script in bash is still an option.

    Let me be 100% clear: yes, fish will complain if a wildcard doesn’t expand to anything, and there are other minor things that may impact typical interactive use. I’m just saying there is basically zero learning curve if you want to try fish and that you can just fire up bash if you hit a wall in a moment when you can’t afford to investigate because you need stuff done.

    If I had to say, the most hassle with fish is that people assume you are running POSIX shell and so you have to know how to adapt instructions to your shell. For example, someone may say “add expor SOME_VAR=some_value to your .bashrc” and you need to be able to translate that to fish. Also, there is very specific software (in my system, it’s just sdkman, an utility that manages which java development tools are installed/available in a shell session) that only works in POSIX shells and needs some adapter for fish.


  • I bet that doesn’t exist: nobody would put work in a program that lets just restricts what you can do with zero usability advantages (ok someone might)

    If you fear you might run unsafe commands just save whatever you are comfortable running in scripts and restrict yourself to run those instead of manually typing commands you don’t fully remember/understand.

    BTW: topgrade will detect what needs updating in your system (your distro’s package manager, flatpak, python stuff, … whatever) and update all the things

    BTW: “terminal emulator” is the program that shows you text in a window, the program that runs inside it and validates/interprets your commands is a “shell” (the one you are using is most probably bash)


  • Here’s what I get in fish when I start writing a rsync command and hit tab to ask for completions:

    ❱ rsync --append-verify --progress -avz -
    -0  --from0                               (All *from/filter files are delimited by 0s)  --delete                   (Delete files that don’t exist on sender)
    -4  --ipv4                                                               (Prefer IPv4)  --delete-after         (Receiver deletes after transfer, not before)
    -6  --ipv6                                                               (Prefer IPv6)  --delete-before         (Receiver deletes before transfer (default))
    -8  --8-bit-output                          (Leave high-bit chars unescaped in output)  --delete-delay                 (Find deletions during, delete after)
    [more lines omitted]