mastodontech.de ist einer von vielen unabhängigen Mastodon-Servern, mit dem du dich im Fediverse beteiligen kannst.
Offen für alle (über 16) und bereitgestellt von Markus'Blog

Serverstatistik:

1,5 Tsd.
aktive Profile

#shellscripting

2 Beiträge2 Beteiligte1 Beitrag heute
R.L. Dane :Debian: :OpenBSD: 🍵 :MiraLovesYou:<p>In the helpful shell functions department:</p><p>(Requires <code>bc</code> to be installed)</p><pre><code>load() { local load=$(uptime |sed -E "s/^.*load averages?: //; s/,.*$//") local uname="$(uname)" local cpus if [[ $1 == -q ]]; then echo "$load" elif [[ $1 == -i ]]; then echo "$load + 0.5" |bc -l |cut -f1 -d. else case "$uname" in Linux) cpus=$(grep -c ^processor /proc/cpuinfo);; *BSD) cpus=$(sysctl hw.ncpu |tr -dc "0-9\n");; *) warn "load(): assuming 1 cpu, don't know how to get the number in \"$uname\"" cpus=1;; esac local loadPerCPU=$(echo "scale=3; $load / $cpus" |bc -l |sed 's/^\./0./') echo "$load ($loadPerCPU per processor ($cpus))" fi } </code></pre><p><a href="https://polymaths.social/tags/shellscripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://polymaths.social/tags/unixshell" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>UnixShell</span></a> <a href="https://polymaths.social/tags/shellscripts" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripts</span></a> <a href="https://polymaths.social/tags/bash" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>bash</span></a> <a href="https://polymaths.social/tags/ksh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ksh</span></a> <a href="https://polymaths.social/tags/sh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>sh</span></a></p>
R.L. Dane :Debian: :OpenBSD: 🍵 :MiraLovesYou:<p><a href="https://polymaths.social/tags/poll" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Poll</span></a>: Curious about people's attitudes towards shell scripting.</p><p>Two part question:</p><ol><li>Are you a DEVeloper (or working in a development-heavy role), OTHER-IT worker (such as a sysadmin, architect, anything in a non-development-heavy role), or NON-IT (accountant, doctor, whatever)</li><li>Do you HATE shell scripting, are you INDIFferent towards (or ignorant of) shell scripting, or do you LOVE it?</li></ol><p><a href="https://polymaths.social/tags/unix" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Unix</span></a> <a href="https://polymaths.social/tags/unixshell" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>UnixShell</span></a> <a href="https://polymaths.social/tags/shellscript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScript</span></a> <a href="https://polymaths.social/tags/shellscripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://polymaths.social/tags/posix" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>POSIX</span></a> <a href="https://polymaths.social/tags/posixshell" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>PosixShell</span></a> <a href="https://polymaths.social/tags/sh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>sh</span></a> <a href="https://polymaths.social/tags/bash" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>bash</span></a> <a href="https://polymaths.social/tags/zsh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>zsh</span></a> <a href="https://polymaths.social/tags/csh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>csh</span></a> <a href="https://polymaths.social/tags/tcsh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>tcsh</span></a> <a href="https://polymaths.social/tags/ksh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ksh</span></a> <a href="https://polymaths.social/tags/pdksh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>pdksh</span></a> <a href="https://polymaths.social/tags/oksh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>oksh</span></a> <a href="https://polymaths.social/tags/mksh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>mksh</span></a></p>
No Starch Press<p>Effective Shell isn't just a command-line tutorial—it's a clear, practical guide to building a flexible development environment that works across tools, teams, and machines. </p><p>From shell scripting to dotfiles, it's a valuable reference for anyone who lives in the terminal.</p><p><a href="https://nostarch.com/effective-shell" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">nostarch.com/effective-shell</span><span class="invisible"></span></a> </p><p><a href="https://mastodon.social/tags/Linux" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Linux</span></a> <a href="https://mastodon.social/tags/DevTools" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DevTools</span></a> <a href="https://mastodon.social/tags/ShellScripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://mastodon.social/tags/FOSS" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>FOSS</span></a> <a href="https://mastodon.social/tags/Vim" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Vim</span></a></p>
~/phranck :antifa:<p>Liebe Folglinge,</p><p>ich suche leider noch immer nach einem neuen Job als <a href="https://nerdculture.de/tags/iOS" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>iOS</span></a> und/oder <a href="https://nerdculture.de/tags/macOS" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>macOS</span></a> Entwickler. Ich spreche <a href="https://nerdculture.de/tags/ObjectiveC" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ObjectiveC</span></a>, <a href="https://nerdculture.de/tags/Swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Swift</span></a> (auch Server-Side) und <a href="https://nerdculture.de/tags/SwiftUI" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SwiftUI</span></a> und nutze die ganzen Tools drumherum (<a href="https://nerdculture.de/tags/Xcode" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Xcode</span></a>, <a href="https://nerdculture.de/tags/Git" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Git</span></a>, <a href="https://nerdculture.de/tags/GitHub" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>GitHub</span></a>, <a href="https://nerdculture.de/tags/GitHubActions" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>GitHubActions</span></a>, <a href="https://nerdculture.de/tags/ShellScripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> etc.). Ich bringe 30 Jahre Berufserfahrung als Software-Entwickler mit, davon knapp 20 im <a href="https://nerdculture.de/tags/Apple" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Apple</span></a> Ökosystem.</p><p>Am Idealsten waere eine <a href="https://nerdculture.de/tags/Festanstellung" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Festanstellung</span></a> zu 100% remote. Sollte es im Raum <a href="https://nerdculture.de/tags/Bregenz" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Bregenz</span></a> oder <a href="https://nerdculture.de/tags/Dornbirn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Dornbirn</span></a> etwas geben, dann auch gerne vor Ort.</p><p>Ich danke euch fuers Teilen. 🙏🏻<br>:boost_ok: </p><p>LinkedIn: <a href="https://www.linkedin.com/in/phranck/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="">linkedin.com/in/phranck/</span><span class="invisible"></span></a><br>Xing: <a href="https://www.xing.com/profile/Frank_Gregor063742/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">xing.com/profile/Frank_Gregor0</span><span class="invisible">63742/</span></a></p><p><a href="https://nerdculture.de/tags/FediHire" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>FediHire</span></a> <a href="https://nerdculture.de/tags/JobSuche" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>JobSuche</span></a> <a href="https://nerdculture.de/tags/RemoteJob" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>RemoteJob</span></a> <a href="https://nerdculture.de/tags/Arbeit" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Arbeit</span></a></p>
Diego Córdoba 🇦🇷<p>1/3<br>🔥 ¡Nueva promoción de precios mínimos por tiempo limitado!</p><p>¿Querés aprender Linux, Redes, Python/Flask, shell scripting, Wireshark, SSH, iptables y más?</p><p>Todos nuestros cursos a sólo USD 9.99 por 5 días!</p><p>Acá los descuentos. Te esperamos!! 👇 👇 </p><p>(Por otras formas de pago: info@juncotic.com)</p><p><a href="https://mstdn.io/tags/Linux" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Linux</span></a> <a href="https://mstdn.io/tags/Redes" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Redes</span></a> <a href="https://mstdn.io/tags/TCPIP" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>TCPIP</span></a> <a href="https://mstdn.io/tags/Python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Python</span></a> <a href="https://mstdn.io/tags/Flask" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Flask</span></a> <a href="https://mstdn.io/tags/shellscripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>shellscripting</span></a> <a href="https://mstdn.io/tags/Wireshark" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Wireshark</span></a> <a href="https://mstdn.io/tags/SSH" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SSH</span></a> <a href="https://mstdn.io/tags/iptables" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>iptables</span></a> <a href="https://mstdn.io/tags/firewall" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>firewall</span></a> </p><p>🧵</p>
DeadSwitch @ T0m's 1T C4fe<p>Mastering Linux isn't about memorizing commands. It's about thinking like the machine. Adapt. Script. Conquer. </p><p><a href="https://mastodon.social/tags/Linux" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Linux</span></a> <a href="https://mastodon.social/tags/FOSS" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>FOSS</span></a> <a href="https://mastodon.social/tags/Automation" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Automation</span></a> <a href="https://mastodon.social/tags/ShellScripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://mastodon.social/tags/ThinkLikeADev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ThinkLikeADev</span></a></p>
R.L. Dane :Debian: :OpenBSD: 🍵 :MiraLovesYou:<p><span class="h-card"><a href="https://polymaths.social/@alatartheblue" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>alatartheblue</span></a></span></p><p><a href="https://polymaths.social/tags/shellscripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> is life 😄</p><p><span class="h-card"><a href="https://polymaths.social/@amin" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>amin</span></a></span></p>
lfa :emacs: :tux: :freebsd:<p>When I was young and computer resources were limited I thought: "Why the hell am I messing with shell scripts when I could just do it more easily with Python?"</p><p>30 years later I'm older and computer resources seems to be unlimited and I think: "Why the hell am I wasting resources using Python when shell scripting is already there and does the job?"</p><p><a href="https://hostux.social/tags/UNIX" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>UNIX</span></a> <a href="https://hostux.social/tags/shell" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>shell</span></a> <a href="https://hostux.social/tags/ShellScripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://hostux.social/tags/Python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Python</span></a></p>
R.L. Dane :Debian: :OpenBSD: 🍵 :MiraLovesYou:<p>New <a href="https://polymaths.social/tags/blog" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>blog</span></a> post: Gathering Hashtags from the Fediverse</p><p><a href="https://rldane.space/gathering-hashtags-from-the-fediverse.html" rel="nofollow noopener" target="_blank">https://rldane.space/gathering-hashtags-from-the-fediverse.html</a></p><p>282 words (2233 counting the hashtags, but that's just silly)</p><p>cc: my wonderful <a href="https://polymaths.social/tags/chorus" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>chorus</span></a>: <span class="h-card"><a href="https://polymaths.social/@joel" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>joel</span></a></span> <span class="h-card"><a href="https://polymaths.social/@dm" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>dm</span></a></span> <span class="h-card"><a href="https://polymaths.social/@sotolf" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>sotolf</span></a></span> <span class="h-card"><a href="https://polymaths.social/@thedoctor" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>thedoctor</span></a></span> <span class="h-card"><a href="https://merveilles.town/@pixx" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>pixx</span></a></span> <span class="h-card"><a href="https://behold.mylegendary.quest/users/twizzay" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>twizzay</span></a></span> <span class="h-card"><a href="https://polymaths.social/@orbitalmartian" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>orbitalmartian</span></a></span> <span class="h-card"><a href="https://fosstodon.org/@adamsdesk" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>adamsdesk</span></a></span> <span class="h-card"><a href="https://polymaths.social/@krafter" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>krafter</span></a></span> <span class="h-card"><a href="https://polymaths.social/@roguefoam" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>roguefoam</span></a></span> <span class="h-card"><a href="https://polymaths.social/@clayton" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>clayton</span></a></span> <span class="h-card"><a href="https://fosstodon.org/@giantspacesquid" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>giantspacesquid</span></a></span></p><p>(I will happily add/remove you from the chorus upon request! :)</p><p><a href="https://polymaths.social/tags/100daystooffload" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>100DaysToOffload</span></a> #27</p><p><a href="https://polymaths.social/tags/rldanewriting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>rlDaneWriting</span></a> <a href="https://polymaths.social/tags/hashtags" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>hashtags</span></a> <a href="https://polymaths.social/tags/bash" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>bash</span></a> <a href="https://polymaths.social/tags/oneliner" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>OneLiner</span></a> <a href="https://polymaths.social/tags/oneliners" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>OneLiners</span></a> <a href="https://polymaths.social/tags/shellscripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://polymaths.social/tags/fediverse" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Fediverse</span></a> <a href="https://polymaths.social/tags/api" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>API</span></a></p>
Richard Emling (DO9RE)<p>I'm exploring ways to improve audio preprocessing for speech recognition for my [midi2hamlib](<a href="https://github.com/DO9RE/midi2hamlib" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">github.com/DO9RE/midi2hamlib</span><span class="invisible"></span></a>) project. Do any of my followers have expertise with **SoX** or **speech recognition**? Specifically, I’m seeking advice on: 1️⃣ Best practices for audio preparation for speech recognition. 2️⃣ SoX command-line parameters that can optimize audio during recording or playback. <br> <a href="https://github.com/DO9RE/midi2hamlib/blob/main/tests/speech_menu.sh" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/DO9RE/midi2hamlib/b</span><span class="invisible">lob/main/tests/speech_menu.sh</span></a> <a href="https://metalhead.club/tags/SoX" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SoX</span></a> <a href="https://metalhead.club/tags/SpeechRecognition" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SpeechRecognition</span></a> <a href="https://metalhead.club/tags/OpenSource" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>OpenSource</span></a> <a href="https://metalhead.club/tags/AudioProcessing" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>AudioProcessing</span></a> <a href="https://metalhead.club/tags/ShellScripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://metalhead.club/tags/Sphinx" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Sphinx</span></a> <a href="https://metalhead.club/tags/PocketSphinx" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>PocketSphinx</span></a> <a href="https://metalhead.club/tags/Audio" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Audio</span></a> Retoot appreciated.</p>
Doc Edward Morbius ⭕​<p>Apropos an ongoing project, looking at sed, and realising:</p><ul><li>It can execute external commands (e)</li><li>It can read in entire files at a given address within the input stream (r).</li><li>It can read in specified external files on a line-by-line basis at a specified address within the input stream (R).</li></ul><p>I've only been using sed for, oh, 40 years.</p><p><a href="https://www.gnu.org/software/sed/manual/sed.html" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">gnu.org/software/sed/manual/se</span><span class="invisible">d.html</span></a></p><p><a href="https://toot.cat/tags/sed" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>sed</span></a> <a href="https://toot.cat/tags/ShellTools" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellTools</span></a> <a href="https://toot.cat/tags/linux" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>linux</span></a> <a href="https://toot.cat/tags/unix" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>unix</span></a> <a href="https://toot.cat/tags/til" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>til</span></a> <a href="https://toot.cat/tags/shellScripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>shellScripting</span></a></p>
Starbeamrainbowlabs<p>Cute little script is cool! I wrote a little bash script to wrap around a thesaurus .txt file I found in a unix stack exchange answer (link in script).</p><p>It started out as a one-liner, but I adapted it after the results were not completely terrible, though I'm always looking for better ones.</p><p>Why are all thesauruses (thesauri? thesauruseseseses?) online and why aren't there any decent local offerings for linux?</p><p>Either way, enjoy this little standalone bash script - I'm p proud of the ranking algorithm implementation in the big piped one-liner bit at the end.</p><p><a href="https://gitlab.com/sbrl/bin/-/raw/master/thesaurus" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">gitlab.com/sbrl/bin/-/raw/mast</span><span class="invisible">er/thesaurus</span></a></p><p><a href="https://fediscience.org/tags/IveWrittenABunchOfOtherLittleUtilitiesAndStuffRecentlyCheckMyBinGitRepo" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>IveWrittenABunchOfOtherLittleUtilitiesAndStuffRecentlyCheckMyBinGitRepo</span></a> <a href="https://fediscience.org/tags/Linux" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Linux</span></a> <a href="https://fediscience.org/tags/Bash" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Bash</span></a> <a href="https://fediscience.org/tags/ShellScripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://fediscience.org/tags/Thesaurus" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Thesaurus</span></a> <a href="https://fediscience.org/tags/Utilities" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Utilities</span></a></p>
Jonathan Kamens 86 47<p>Today I learned from the flock(1) man page (on Debian) that you can put this line at the top of a shell script to prevent more than one copy of it from ever running at a time:</p><p>[ "${FLOCKER}" != "$0" ] &amp;&amp; exec env FLOCKER="$0" flock -en "$0" "$0" "$@" || :</p><p>This is an extremely clever hack and I don't know how I've never stumbled upon it in 38 years of writing shell scripts.<br><a href="https://federate.social/tags/unix" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>unix</span></a> <a href="https://federate.social/tags/linux" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>linux</span></a> <a href="https://federate.social/tags/scripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>scripting</span></a> <a href="https://federate.social/tags/shellScripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>shellScripting</span></a></p>
R.L. Dane :Debian: :OpenBSD: 🍵 :MiraLovesYou:<p>Update: derp, just use readlink, derp. XD</p><p>In the <a href="https://polymaths.social/tags/idontknowwhyididntwritethisyearsago" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>iDontKnowWhyIdidntWriteThisYearsAgo</span></a> category:</p><pre><code>~ $ type deref deref is a function deref () { stat -c "%N" "$*" | cut -f4 -d\' } ~ $ which gcc /usr/bin/gcc ~ $ deref $(which gcc) gcc-14 ~ $ deref $(which $(deref $(which gcc))) x86_64-linux-gnu-gcc-14 </code></pre><p><a href="https://polymaths.social/tags/bash" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>bash</span></a> <a href="https://polymaths.social/tags/shell" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>shell</span></a> <a href="https://polymaths.social/tags/shellscripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://polymaths.social/tags/unix" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Unix</span></a></p>
R.L. Dane :Debian: :OpenBSD: 🍵 :MiraLovesYou:<p>I've probably tooted about this before, but I don't know why this isn't standard.</p><p>It's just so obvious, at least to me. ;)</p><pre><code>~ $ type mcd mcd is a function mcd () { [[ -n $1 ]] &amp;&amp; mkdir "$1" &amp;&amp; cd "$1" } </code></pre><p><a href="https://polymaths.social/tags/shell" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>shell</span></a> <a href="https://polymaths.social/tags/unixshell" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>UnixShell</span></a> <a href="https://polymaths.social/tags/shellscripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://polymaths.social/tags/sh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>sh</span></a> <a href="https://polymaths.social/tags/bash" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>bash</span></a> <a href="https://polymaths.social/tags/ksh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ksh</span></a> <a href="https://polymaths.social/tags/mksh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>mksh</span></a></p>
Moritz Strohm<p>I think I won't bother anymore with writing (bash) shell scripts that are longer than a few lines. I find the syntax too unintuitive and there are better programming languages like PHP that produce more readable code.</p><p>In the last two hours, I translated a bash shell script with ~250 lines to a PHP CLI script. The latter is nearly 400 lines long but definetly more readable and it also has more user-friendly output.</p><p>1/2</p><p><a href="https://kanoa.de/tags/Shell" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Shell</span></a> <a href="https://kanoa.de/tags/ShellScripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://kanoa.de/tags/CLI" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CLI</span></a> <a href="https://kanoa.de/tags/PHP" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>PHP</span></a> <a href="https://kanoa.de/tags/Programming" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Programming</span></a></p>
R.L. Dane :Debian: :OpenBSD: 🍵 :MiraLovesYou:<p>Interesting <a href="https://polymaths.social/tags/shellscripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> quandary:</p><p><strong>(solution below)</strong></p><p>I'm uncertain how shells delimit filename variables internally.</p><p>I have a shell (bash) function that loops through a set of PDF files, opening them in zathura in a "suckless" tabbed window (so that the PDFs always open within the same window, so I can just hit <code>q</code> to zip through them one-at-a-time.</p><p>Here is my variable declaration:</p><pre><code>local files=${*-*.[pP][dD][fF]} </code></pre><p>But for simplicity, you could just imagine it to be:</p><pre><code>files=* </code></pre><p>Then I'm doing a</p><pre><code>for f in $files; do </code></pre><p>I'm wanting to print a status line for each item viewed, so I have an idea how many more there are to go, so I'm using this:</p><pre><code>echo "[[$f]] ($count/$tot)" </code></pre><p>And of course, there's a <code>((count++))</code> at the beginning of the loop.</p><p>But how to get the total (<code>$tot</code>)??</p><p><code>echo $files |wc -l</code> will always result in <code>1</code>, as does <code>echo "$files" |wc -l</code></p><p>What I ended up doing was just creating a</p><pre><code>for f in $files; do ((tot++)); done </code></pre><p>One-liner loop <em>before</em> the actual loop, just to get a total.</p><p>Is there a better way?</p><p>Am I missing something really obvious?</p><p><strong>Solution, courtesy of <span class="h-card"><a href="https://hj.9fs.net/khm" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>khm</span></a></span></strong></p><p>Use an array!</p><pre><code>local files=(${*-*.[pP][dD][fF]}) echo "[[$f]] ($count/${#files[@]})" </code></pre>
R.L. Dane :Debian: :OpenBSD: 🍵 :MiraLovesYou:<p>Should've made this a long time ago:</p><pre><code>function ciglob { #case-insensitive glob generator echo "$*" |while read -N1 c; do case "$c" in [a-zA-Z]) echo -n "[${c^^}${c,,}]";; *) echo -n "$c" esac done } </code></pre><pre><code>~ $ ciglob "Hello, world!" [Hh][Ee][Ll][Ll][Oo], [Ww][Oo][Rr][Ll][Dd]! ~ $ ls -ld $(ciglob documents) drwxr-xr-x 52 ~~~ ~~~ 20,480 Apr 10 11:45 Documents </code></pre><p>(Not the most useful example, but I did have a use case in mind when I wrote it ;)</p><p>P.S. (This is a valid way to close a parenthesis. Fight me ;)</p><p><a href="https://polymaths.social/tags/bash" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>bash</span></a> <a href="https://polymaths.social/tags/ksh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ksh</span></a> <a href="https://polymaths.social/tags/sh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>sh</span></a> <a href="https://polymaths.social/tags/shell" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>shell</span></a> <a href="https://polymaths.social/tags/unixshell" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>UnixShell</span></a> <a href="https://polymaths.social/tags/posix" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>POSIX</span></a> <a href="https://polymaths.social/tags/posixshell" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>PosixShell</span></a> <a href="https://polymaths.social/tags/shellscripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a></p>
Hacker News<p>Better Shell History Search</p><p><a href="https://tratt.net/laurie/blog/2025/better_shell_history_search.html" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">tratt.net/laurie/blog/2025/bet</span><span class="invisible">ter_shell_history_search.html</span></a></p><p><a href="https://mastodon.social/tags/HackerNews" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>HackerNews</span></a> <a href="https://mastodon.social/tags/BetterShellHistory" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>BetterShellHistory</span></a> <a href="https://mastodon.social/tags/Search" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Search</span></a> <a href="https://mastodon.social/tags/ShellScripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://mastodon.social/tags/TechTips" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>TechTips</span></a> <a href="https://mastodon.social/tags/DeveloperTools" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DeveloperTools</span></a> <a href="https://mastodon.social/tags/Productivity" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Productivity</span></a> <a href="https://mastodon.social/tags/Hacks" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Hacks</span></a></p>
R.L. Dane :Debian: :OpenBSD: 🍵 :MiraLovesYou:<p><a href="https://polymaths.social/tags/thisisfine" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ThisIsFine</span></a> :BlobFoxThisIsFine:</p><pre><code>#Example directory: 27a81c6a_06f2_4a0b_82a3_5eeee7ef91e8 h="[0-9a-f]" #hex value glob for dir in $h$h$h$h$h$h$h${h}_$h$h$h${h}_$h$h$h${h}_$h$h$h${h}_$h$h$h$h$h$h$h$h$h$h$h$h; do if [[ -d $dir ]]; then ... </code></pre><p><a href="https://polymaths.social/tags/shellscripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://polymaths.social/tags/noimnotputtingituponmygitrepo" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>NoImNOTputtingItUpOnMyGitRepo</span></a> <a href="https://polymaths.social/tags/uglyscriptjustforme" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>UglyScriptJustForMe</span></a></p>