#Shellscripting

R.L. Dane :Debian: :OpenBSD: :FreeBSD: 🍵 :MiraLovesYou:rl_dane@polymaths.social
2026-02-04

File this under #shell #functions I should have written years ago:

function grepc {
    #Do a grep -c, but skipping files with no results
    grep -c "$@" |grep -v ':0$'
}

#unix #UnixShell #ShellScripting #bash #ksh

R.L. Dane :Debian: :OpenBSD: :FreeBSD: 🍵 :MiraLovesYou:rl_dane@polymaths.social
2026-02-02

P.S., the body of the parent #toot was created by a simple #shell #function:

function apod {
    #Today's NASA Astronomy Picture of the Day info-fetcher
    curl -sL 'https://apod.nasa.gov/apod/archivepix.html' \
        |grep -m1 "[0-9][0-9]:" \
        |sed 's/^/Date: /;
            s|: *<a href="|\nURL: https://apod.nasa.gov/apod/|;
            s/">/\nTitle: /; s/<.*$//'
    echo
    echo "#NASA #Astronomy #PictureOfTheDay"
}

#bash #ksh #mksh #shellScripting #unix #UnixShell #WebScraping #Scraping #HTML

David Cantrell 🏏DrHyde@fosstodon.org
2026-01-27

I've been playing with #ntfy. It seems nifty, but if I'm going to use it to get notifications from a #cron job I want more reliability - I want cron to email me if there's an error sending the notification. And so I wrote a thing: github.com/DrHyde/shellscripts.

After pushing I noticed some dead code, left over from an earlier version. And I noticed the "ask #Copilot" thing on Github. So I asked it if all the code was reachable. See follow-up for the impressive results.

#ShellScripting

2026-01-26

quicktipp #110: Looking at minified html output from curl isn't always fun.

Let's create a simple `htmlcat` bash function around `tidy` (for prettyprint) + `bat` (for syntax highlight) so we can just run

"curl example.com | htmlcat"
or
"htmlcat file.html"

$ # minified HTML somtimes sucks
$ curl -s http://example.com
<!doctype html><html lang="en"><head><title>Example Domain</title><meta name="viewport" content="width=device-width, initial-scale=1"><style>body{background:#eee;width:60vw;margin:15vh auto;font-family:system-ui,sans-serif}h1{font-size:1.5em}div{opacity:0.8}a:link,a:visited{color:#348}</style><body><div><h1>Example Domain</h1><p>This domain is for use in documentation examples without needing permission. Avoid use in operations.<p><a href="https://iana.org/domains/example">Learn more</a></div></body></html>
$
$ # lets create a `htmlcat` shell function around `tidy` (for html prettyprinting) and `bat` (syntax highlighting)
$ grep htmlcat ~/.bashrc
htmlcat() { tidy -i -q "${1:-/dev/stdin}" | bat --paging=never -p -l html; }
$
$ # much nicer now! (also works with `htmlcat file.html`)
$ curl -s http://example.com | htmlcat
<!DOCTYPE html>
<html lang="en">
<head>
...
</head>
<body>
  <div>
    <h1>Example Domain</h1>
...
  </div>
</body>
</html>
$
2026-01-24

🆕 **VenomShell** - Công cụ thực thi Bash mới cực nhanh, viết từ đầu bằng C!

✅ Tương thích Bash (cú pháp, pipelines, biến, hàm...)
🚀 Hiệu năng vượt trội: Xử lý mở rộng chuỗi **nhanh hơn 11.000x**, logic số học **3x** so với Bash
🔧 Đang trong giai đoạn Developer Preview (test 90/90 tính năng chính, lỗi nhỏ ở history)

Dành cho dev quan tâm hệ thống & tối ưu shell script!

#Programming #ShellScripting #Bash #DevTools
#LậpTrình #MáyTính #TinHọc

reddit.com/r/programming/c

2026-01-23

Pipe‑Llama: công cụ cho phép nhúng LLM vào script shell và pipeline dòng lệnh, cực kỳ đơn giản. Khởi chạy LLM trực tiếp trong terminal, hỗ trợ Ollama và các mô hình khác. Đang được chia sẻ trên GitHub. #GitHub #LLM #ShellScripting #AI #CôngCụ #LậpTrình #MãNguồn

reddit.com/r/ollama/comments/1

Python Job Supportpythonjobsupport
2026-01-16

Shell Scripting in 20 Minutes – Crash Course | In One Video for Beginners | MPrashant

linux Hello Dosto: In this video I have covered all the Shell Scripting Concept in just 1 ... source

quadexcel.com/wp/shell-scripti

2026-01-10

Bash turns 38 today! Celebrate Bash's 38th birthday with 38 built-in features and essential tips. Learn keyboard shortcuts, parameter expansion, conditionals & more.

Full guide here: ostechnix.com/38-bash-tips-she

#Bash #Shell #Bash38 #Linux #Bashtips #Shelltips #Shellscripting #Linuxhowto #Linuxbasics #Linuxcommands

R.L. Dane :Debian: :OpenBSD: :FreeBSD: 🍵 :MiraLovesYou:rl_dane@polymaths.social
2025-12-04

Just three new bash #functions I don't know why I didn't write months/years ago ;)

function binfind {
    #search for patterns in the system bin directories
    local d oIFS="$IFS"
    IFS=:
    for d in $PATH; do
        ls -1 $d/$@ 2>&-
    done
    IFS="$oIFS"
}

function tootlookup {
    #Show a fediverse thread when given a url
    url="$*"
    [[ $url == http* ]] || ( warn "please specify URL"; return 1 );
    toot --no-color thread $(toot --no-color search "$url" |awk '$1=="*" {print $2}' |head -1)
}

function colors {
    #uses ImageMagick identify to print the number of colors in a specified image
    local oIFS="$IFS" output maxlen=0
    IFS=$'\n'
    for f in $@; do
        (( ${#f} >> maxlen )) && maxlen=${#f}
    done
    ((maxlen+=4))
    for f in $@; do
        printf "%-${maxlen}s " $f
        output=$(identify -verbose $f |& grep Colors: |sed 's/^ *Colors: //')
        [[ -n $output ]] || output="(unknown)"
        echo $output
    done
    IFS="$oIFS"
}

#Unix #shell #ShellScripting

R.L. Dane :Debian: :OpenBSD: :FreeBSD: 🍵 :MiraLovesYou:rl_dane@polymaths.social
2025-11-22

@gumnos @nixCraft

Ahh, seems like vm.stats.vm.v_active_count is the closest to what I want in terms of RAM actually used by processes then, thank you both!! :D

Wait, spoke too soon. XD
Still working it out...

Ok,

echo $(( ($(sysctl -n vm.stats.vm.v_active_count) + $(sysctl -n vm.stats.vm.v_inactive_count) ) * $(sysctl -n hw.pagesize) /1048576 ))

...seems to get me the closest to what I want, and closely matches what systat -vmstat displays, as well as top "Active" + "Inact", although btop disagrees and shows about half as much. XD

Ok guys, I got it. ;)

https://codeberg.org/rldane/scripts/src/branch/main/freebsdfree

(Should hopefully be available by the time you read this. My git push is taking a while, for some reason)

#FreeBSD #shell #ShellScripting #utility

2025-11-20

Is there any framework to create shell scriprs?

I'm getting the nerves with so much shell-foo.

I use git in a shell because that's just what I prefer, and I have a lot of aliases set up to shorten commands, e.g. just "g" will be git commit, "gp" is git push etc.
I just realized that this also gives me some safety. I use PageUp to complete the currently typed thing to the last command I executed that starts the same. This will never wrongly complete my aliases to something like "git reset" because I do not have aliases for that and none of my aliases start with "gi".
#git #shellScripting

Axel 🚴😷🐧🐪⌨ | #WeAreNatenomxtaran@chaos.social
2025-10-14

#PSA regarding #GNU #coreutils #sort's unexpected or at least non-intuïtive behaviour of its --unique (-u) option together with --numeric (-n) or --human (-h).

The output of piping something through

sort -nu

might not be equal to the output of piping the same thing through

sort -n | uniq

as it might miss some lines completely. 🤌

And it's NOT documented in the man page, just in the info page.

Related bug reports:

debbugs.gnu.org/cgi/bugreport.
bugs.debian.org/893524

#WTF #CLI #Shellscripting

I created a shell script which lets you use Chromium as an image viewer that has the Wayland Color Management Protocol implemented:

https://github.com/blitzgneisserin/chromium-as-image-viewer

#chromium #linux #opensource #color #wayland #colormanagement #imageviewer #chrome #shellscripting
screenshot of Chromium as an image viewer - I created a shell script which lets you use Chromium as an image viewer that has the Wayland Color Management Protocol implementedscreenshot of the github repo of the script
N-gated Hacker Newsngate
2025-10-12

A brave soul attempts to merge the elegance of with the chaos of shell scripting, like trying to paint a masterpiece with a chainsaw. 🖼️🔪 Meanwhile, GitHub's thinks it's helping, but we're just one step closer to replacing with bloatedware. 🤖💡
github.com/gue-ni/redstart

2025-10-04

Fish Shell 4.1.0 è qui! Nuove funzioni, sintassi migliorata e un terminale ancora più intuitivo per Linux. #FishShell #LinuxTerminal #ShellScripting #OpenSource #CLI

linuxeasy.org/fish-shell-4-1-0

N-gated Hacker Newsngate
2025-09-30

🚀 Introducing the ABSurd Programming 🎉—because who doesn't want to combine the excitement of shell scripting with the thrill of reinventing the wheel? 🛞 With a syntax that borrows "creatively" from every other language, ABS will make you feel right at home...if your home is a chaotic circus of half-baked ideas. 🎪💻
abs-lang.org/

~/phranck :antifa:phranck@oldbytes.space
2025-09-25

Liebe Folglinge,

ich suche nach einem neuen Job als #iOS und/oder #macOS Entwickler. Ich spreche #ObjectiveC, #Swift (auch Server-Side) und #SwiftUI und nutze die ganzen Tools drumherum (#Xcode, #Git, #GitHub, #GitHubActions, #ShellScripting etc.). Ich bringe 30 Jahre Berufserfahrung als Software-Entwickler mit, davon knapp 20 im #Apple Ökosystem.

Am Idealsten waere eine #Festanstellung zu 100% remote. Sollte es im Raum #Bregenz oder #Dornbirn etwas geben, dann auch gerne vor Ort.

Ich danke euch fuers Teilen. 🙏🏻

LinkedIn: linkedin.com/in/phranck/
Xing: xing.com/profile/Frank_Gregor0

#FediHire #FediJobs #JobSuche #RemoteJob #Arbeit

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst