#bash — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #bash, aggregated by home.social.
-
Bartleby, the Script.
#bartleby #script #computerart #coding #idleness #bash #art #programming
-
@tlohde https://tldp.org/guides.html as a person with many many moons of linux use under my belt I still use TLDP as a reference.
The bash beginner and advanced guides both touch on what you mentioned.
Why I enjoy these docs is that they're not overly technical and jargon laden.
Also I will say *loads* of people on fedi love discussing and answering any sort of questions on the #linux and #bash tags. I haven't really seen people be jerks. Just people enthusiastically helping.
-
I've been a full-time #linux user for about 18 months now. First #ubuntu, then #mint, now #fedora (yes, it is very likely mastodon's fault). Very happy with it all. And I have learnt plenty. Seeking #recommendations for (e)books or courses for learning how to terminal/bash better. If it's free (or low cost) that'd be cool, because money is pretty tight right now.
I'm not a complete beginner, but sed and parameter expansion and regex-looking things are intimidating.
boosts welcome, I suppose.
-
MIMEcroft.sh: a 3D game written in bash
https://gmatht.github.io/j.cmd/www/MIMEcroft.html is a parody of every 3D game ever, that lovingly pokes fun of bash's reputation for poor performance - by subverting it. MIMEcroft.sh is written entirely in Bash. The game logic, GPU shaders, even the sounds and textures are procedurally generated with bash commands.
One may wonder how MIMEcroft.sh pumps out 90fps at 4K given bash's reputation for poor performance. Indeed, the official GNU bash reference interpreter is poorly optimised compared to languages more commonly used for game development like C++. However, if your web-browser has a GUI it almost certainly also has a highly optimised JavaScript interpreter.
The online JavaScript Commandline OS (j.cmd) did not port the reference implementation of bash and coreutils. Instead it takes the abstract language they describe. This language is translated into JavaScript, which a modern runtime can often reduce to machine code, resulting in performance over a thousand times faster than the original bash.
For a concrete if somewhat contrived example say you are interested in finding numbers with 1337 squares, and use the one-liner:
for i in `seq 1 10000`;do if echo $((i*i)) | grep 1337 > /dev/null;then echo $i;fi;done
In the official bash interpreter, this may take a minute. However, j.cmd implements it by first transpiling it into:
for (let i = 1; i <= 10000; i++) {
if (String(i * i).includes("1337")) {
process.stdout.write(i + "\n");
}
}
sh2.lastExit = 0;Then it is all over in the blink of an eye.
One might well argue that this is not a real bash game since it has to transpile to JS before being run. A stronger argument could be made that C++ games are not real C++ games. A C++ game also has to be compiled. In most "C++" games the developer doesn't even give you the C++ source, you only ever get the compiled machine code. MIMEcroft.sh is stored and distributed as bash. You can edit it as bash (try e.g. `vi /bin/mimecroft.sh` in j.cmd, changing `cys=0.900` to `cys=3.900` and playing the game again). The current version of j.cmd doesn't even cache the transpiled JS version of the game.
____________
It is important to note that j.cmd is experimental and still has many bugs. One little way it is more robust than the traditional bash implementations is that traditional shells tend to break if they source a file that isn’t in their own special format. On the other hand, j.cmd sees different shell formats as just different ways of saying the same thing. It will quite happily run:for f in /home/examples/source.{bat,c,fish,sh,zsh}; do . $f; done
Sourcing C files is still a work in progress in j.cmd. I recently added support for passing linked lists and pointers to bash variables/functions into sourced C functions, and cd'ing around C pointer structure.
#bash #sh #shellScripting #Linux #games #3D #Javascript #GLSL -
I love to use #wireshark directly via #SSH with this tiny #bash script:
#!/usr/bin/env sh
# https://www.commandlinefu.com/commands/view/6912/analyze-traffic-remotely-over-ssh-w-wireshark
FILTER='not port 22'
if [ $# -lt 1 ]; then
echo "Syntax: $0 <FQDN> [filter]"
exit 1
fiTARGET_HOST="${1}"; shift
if [ $# -ge 1 ]; then
FILTER="${FILTER} and $@"
fiecho "#####################################################"
echo "USING FILTER: ${FILTER}"
echo "#####################################################"ssh "${TARGET_HOST}" sudo tcpdump -i any -U -s0 -w - "${FILTER}" | wireshark -k -i -
-
Скрипт деплоя отчитался об успехе, а на сервере осталась старая версия: 5 ошибок в bash, которые допускают новички
Зелёный пайплайн ещё не означает, что деплой прошёл как надо. В Bash хватает ситуаций, где ошибка теряется, код возврата маскируется, а скрипт спокойно идёт дальше. Разберём типичные ловушки и способы сделать такие сценарии предсказуемее. Разобрать ошибки
https://habr.com/ru/companies/otus/articles/1068482/
#Bash #shellскрипты #Linux #обработка_ошибок #деплой #pipefail #ShellCheck #автоматизация
-
Need to create a bunch of files or directories on Linux each with a new number?
🪄 A shell like bash can expand what is within the curly braces. You can even use steps en prefix with zeroes, so all names are equally long and easy to sort.
💡 Good to know: not all shells support this, so be careful in scripts.
-
Yes, you use this command sequence from any of your most favorite shells, to compile your Source Code
Regardless of the operating system you run, you can get a command shell which is Open Source by downloading a GNU package sequence for it.
For mac & win64 they are also available.
Without a command line programming would be impossible
Sources
-
Okay this might be a really weird question but I have one question regarding command-line-only workflows.
I am already used to and very comfortable working in the command line as is.
And as any heavy user of the terminal will know, at some point you'll probably start writing scripts and functions and aliases to create your own little shortcuts for common tasks or preferred program call-up options and such. So do I.
Now my weird little 'problem' is that I don't always remember all of the scripts, aliases, functions and even programs I built for my workflow over the years off the top of my head.
For example, I might have an "update" alias set up, but nine out of ten times will still enter the command manually out of sheer habit.
Or I will have a calendar or to-do application for the CLI/TUI, but sometimes forget that I have it installed when I need it. Or I'll forget where the files are I set up to organise my journal or my time tracking.
Or going even further, I don't always remember all the neat features of my shell I could use, or the computing/typing habits I wanted to build, or the projects I have going on, and so on!
In a graphical desktop environment or on a mobile UI, you have tools like desktop shortcuts, quickstart icons or application launcher menus for an overview of all of your environment's user-facing programs. Seeing an icon out of the corner of my eye sometimes reminds me of things that a purely reactive user interface like a shell doesn't.
Now there's obviously ways to solve this that come to mind:
- writing a script that prints comprehensive documentation on everything, so I only need to remember that one script name.
- keeping a physical cheat sheet next to my computer.
- using a terminal multiplexer to have a permanent digital 'cheat sheet' or 'launcher' open at the side of the screen.
- trying to just automate these things by using cronjobs/services and shell init scripts to, for example, show me the weather and my to-do list automatically on boot so i don't have to remember these commands at all
- trying to keep a super organised self-documenting file system and harmonious custom dotfile configs so every config is in the same place, every program uses the same keybinds, all scripts are in
~/.bin/or something etc. - writing my own "home page" type greeter.
… but with all of these solutions, while they may work perfectly fine, something doesn't feel "right"!
I mean it's nice and good to print these things upon shell start, but later on in the day that won't be there to look at anymore. The multiplexer one is cumbersome. The self documenting file system organisation sounds like a pain to maintain.
I feel like this is an issue that corporate folks probably should have solved by now, as documenting workflows for employee handovers and stuff is critical there too. Do they use wikis for that? What about all those newfangled workflows like #scrum and #agile and all, do they have anything to say about documentation?
Can anyone relate? How do you handle this?
#linux #unix #commandLine #terminal #cli #tui #tech #askfedi #technology #fish #zsh #bash #shell
-
In bash, how do I check if the user doesn't have a DM and started their WM/DE from a TTY or equivalent?
CC: @rl_dane
-
#Linux #Bash
"Alle meine Mastodon-Follower in ein Array laden" ist jetzt zum Einzeiler geworden.
2. Zeile ist zum Anzeigen
https://gist.github.com/dewomser/e2a175e4c10de51a3fa5be08dfbbcc47 -
I've written more shell scripts than I can count, but I still stumble upon tricks that honestly blow my mind far too often than I care to admit.
Latest thing that blew my head clean off? The shell colon.
-
Event designators have been hiding in not-so-plain-sight since the late 1970s — so powerful that forgetting might be part of a massive conspiracy to wear out developer keyboards faster than otherwise.. maybe.
Please yell in your shell; not at your colleagues.
https://refp.se/articles/your-shell-and-the-lazy-exclamation-mark/
-
(1/2)
Dos nuevos cursos subidos a nuestro campus!! 🎉🎉
Ya tenemos cuatro de nuestras capacitaciones online y disponible para que puedas sumarte!
¿Dónde? Acá tienen toda la info y form de inscripción 👇
¿Listos/as para dar el siguiente paso en su carrera profesional?
Los esperamos/as!
Cualquier consulta, como siempre, nos escriben!
📧 [email protected]#juncotic #capacitacion #gnu #linux #ssh #nftables #firewall #shell #comandos #scripting #bash #cursos
-
Het script is nog niet helemaal wat ik wil, maar de eerste resultaten met oudere PEF-bestanden lijken al heel wat.
Het script is trouwens gemaakt met:
#bash
#awk
#rawtherapee
#enfuse
#imagemagick
en
#zenity -
💻 For small projects, do you automatically reach for #Python or #Bash? Why not #Java?
In his #BaselOne26 workshop, Java Champion @cayhorstmann shows why modern Java is a great fit for scripts, Jupyter notebooks and even browser-based code.
🧑💻 Bring your laptop and learn the tooling and techniques for using Java in small coding tasks — with hands-on exercises throughout the workshop.
🎙️ Program: https://baselone.org/#programm
🎟️ Workshop & combo tickets: https://eventfrog.ch/BaselOne26
-
Quand tu automatises tellement tout que tu en oublies tes propres scripts ! 😅
À 23h pile, notification Gotify : purge massive et nettoyage de /var/log sur tous les nœuds du cluster Proxmox (purge_logs.sh).
Le moment exact où tu te dis : « Ah oui c'est vrai, j'avais écrit un script pour ça ! » 😂
C'est ça, la vraie magie d'un système qui tourne en totale autonomie !
#SysAdmin #Proxmox #Linux #Automation #Bash #Gotify #SelfHosted -
Running Claude Code on Fable or Opus 5 and wondering where your tokens go? It might be your subagents.
Claude Code picks a subagent's model in this order: env var, explicit dispatch parameter, agent frontmatter, session model. The pin everybody uses is rank 3 of 4, and it has silently dropped out across several releases. No error, just a bigger number four weeks later.
These few lines of code fix it: https://thomas-witt.com/blog/blog-subagent-model-pin/
-
Tanto #GOG como #Epic van a lanzar sendas tiendas para #GNU.
No ha hecho falta una base de usuarios muy grande para que se decidan a hacerlo.
Sí que ha hecho falta alguien que creyera en un sistema más justo.
#goodoldgames #epicgames #valve #steamdeck #steammachine #steamos #linux #glibc #x11 #xorg #wayland #mesa #gcc #kde #gnome #bash #grub #wine #dxvk #d7vk #proton