#UnixShell

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

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

Since people are going nuts online about how perfect February 2026 is... here you go:

~ $ cal feb 2026
   February 2026      
Su Mo Tu We Th Fr Sa  
 1  2  3  4  5  6  7  
 8  9 10 11 12 13 14  
15 16 17 18 19 20 21  
22 23 24 25 26 27 28  
                      
                      
~ $ for x in {1900..2050}; do cal feb $x |grep -q "^ 1 " && echo $x; done
1903
1914
1920
1925
1931
1942
1948
1953
1959
1970
1976
1981
1987
1998
2004
2009
2015
2026
2032
2037
2043

#bash #BashOneLiner #ShellOneLiner #shell #UnixShell #unix

2026-01-18

Einleitung in die Linux Shell

Warum du die Shell kennen solltest Bevor Icons und Fenster die Bildschirme der Computer erobert haben, hast du Befehle eingegeben, um mit den meisten Computern zu interagieren. Auf UNIX-Systemen, von denen Linux abstammt, war das Programm, das diese Befehle interpretiert und verwaltet hat, die Shell. Du kannst dich darauf verlassen, dass die Shell unabhängig von deiner Linux-Distribution immer verfügbar ist. Sie ermöglicht dir, ausführbare Skriptdateien zu erstellen, Programme […]

andreas-moor.de/einleitung-in-

2025-12-09

Rule/Yule 30 cellular automaton with a "band-pass" filter every few iterations. Done in the Bash shell using bitwise math, so each row/state is a single number of 63 bits.

#cellularautomata #cellularautomaton #rule30 #bitwiseoperators #textmode #textmodeart #oldskool #retrocomputing #unixshell #shellprogramming #xterm #joulu6 #xmastree #algorithmicart #algorist #mathart #laskutaide #ittaide #kuavataide #iterati

alephoto85 :endeavourOS: :netbsd: :freebsd: :xmpp:alephoto85@fedi.bobadin.icu
2025-11-25

Making a Scheme script on unix

Did you know that UNIX scripts can be made without a shebang line? What happens then? The operating system, when it sees file marked as executable, tries to run it. If it is not executable however it will then try to run it as a shell script.[1] Why is that relevant to scheme?

#scheme #programming #dev #unix #unixshell

https://retropikzel.neocities.org/blog/2025-11-06%20-%20Making%20a%20Scheme%20script%20on%20unix.html

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

Umm, why didn't I do this... years ago??

~ $ wc pinglog.txt 
  387290  1549160 11618700 pinglog.txt
~ $ type commaify
commaify is a function
commaify () 
{ 
    local expr='s/([0-9])([0-9]{3}\>)/\1,\2/g';
    sed -E "$expr; $expr; $expr; $expr; $expr; $expr; $expr; $expr; $expr; $expr"
}
~ $ wc pinglog.txt |commaify
  387,290  1,549,160 11,618,700 pinglog.txt

#bash #shell #UNIX #UnixShell #ShellScripting

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

In the helpful shell functions department:

(Requires bc to be installed)

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
}

#ShellScripting #UnixShell #ShellScripts #bash #ksh #sh

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

#Poll: Curious about people's attitudes towards shell scripting.

Two part question:

  1. 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)
  2. Do you HATE shell scripting, are you INDIFferent towards (or ignorant of) shell scripting, or do you LOVE it?

#Unix #UnixShell #ShellScript #ShellScripting #POSIX #PosixShell #sh #bash #zsh #csh #tcsh #ksh #pdksh #oksh #mksh

Lars Wirzeniusliw@toot.liw.fi
2025-06-09

I experimented with not having persistent shell history, after @simontatham blogged about it.

Good:
- higher threshold for writing long complicated commands
- lower threshold for writing shell scripts instead

Bad:
- writing shell scripts

I've since started experimenting with the Fish shell, and it brings a whole different level to the shell history game. So far I like it.

#UnixShell #shell #bash #fishShell #fish

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

I've probably tooted about this before, but I don't know why this isn't standard.

It's just so obvious, at least to me. ;)

~ $ type mcd
mcd is a function
mcd () 
{ 
    [[ -n $1 ]] && mkdir "$1" && cd "$1"
}

#shell #UnixShell #ShellScripting #sh #bash #ksh #mksh

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

Should've made this a long time ago:

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
}
~ $ 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

(Not the most useful example, but I did have a use case in mind when I wrote it ;)

P.S. (This is a valid way to close a parenthesis. Fight me ;)

#bash #ksh #sh #shell #UnixShell #POSIX #PosixShell #ShellScripting

ZB MEDZBMED
2025-04-10

🛠️ Curious how coding can support your research?
Join our Software Carpentry Workshop for absolute beginners – no experience needed, just curiosity and motivation!

📅 May 12–13, 2025, 09:00–16:00
📍 ZB MED, Cologne
👩‍💻 Hands-on sessions on:

for version control
programming

👩‍🏫 With @RabeaMue, Silvia Di Giorgio & Justine Vandendorpe
🔗 Register: zbmed.github.io/2025-05-12-Sof

Hintergrund: Foto von einer nicht erkennbaren Person mit Laptop, bei dem die Rückseite mit zahlreichen Aufklebern versehen ist, unter anderem The Carpentries, WikiCite, Open Science Radio.
2025-01-19

@jeeynet Salut, merci pour l'idée, je ne savais pas que c'était possible ! Concernant le script proposé, ce test est bizarre  :

if [ "${1}" ]

Si "${1}" venait à coïncider avec un opérateur de test(1) , vous auriez des surprises. Je suggère ceci à la place :

if [[ $# -gt 0 ]]

ou bien

if [[ -n "$1" ]]

Notes :

  • on peut se permettre [[ … ]] car le script utilise Bash;

  • vous pouvez enlever les " autour de $1 dans cet exemple mais attention, c'est un cas bien particulier dû au fait que [[ … ]] ne fait pas de “word splitting” sur l'expression fournie).

#Bash #shell #UnixShell

ZB MEDZBMED
2024-11-29

Invitation: Next Library Carpentry Workshop takes place online on January 20 to 24 together with . Information and registration: zbmed.github.io/2025-01-20-LC_

@thecarpentries

2024-10-31

In a #bash alias:

do something
printf "[ctrl-v] [up-arrow] [ctrl-v] [up-arrow] [ctrl-v] [up-arrow]"
echo something

Whoa, that actually worked?!?

I just got the most retro #Commodore64 feeling from bash of all things. XD

#Unix #Shell #UnixShell #sh

Sampo Rapelisampo@hachyderm.io
2024-09-11

My master's thesis "Understanding the role of Unix shell in software development and developer experience" is now available online!

Explore how developers use the shell, their emotions towards it, and its impact on developer experience.

#unixshell #developerexperience #softwaredevelopment

urn.fi/URN:NBN:fi:aalto-202408

Z3r0 ~ :t_blink:z3r0@maverick-hq.org
2024-07-18
$ cat > file <<EOF
your file
content goes
here
EOF

Más de 10 años viviendo es esto y aún se me olvida como escribir ficheros en Unix sin recurrir a editores de texto ¬¬

#Unix #UnixShell #Linux

Rabea MüllerRabeaMue
2023-11-09

🚀 Neues Video ist live! 🐚 Entdecke die mit meinem interaktiven Screencast. Von der Installation bis zum Shell-Skript – alles dabei! 🌟 Die Lesson online zum Mitmachen💡💻 youtu.be/L3JRQC_tZ4E?si=lZlkHW

Client Info

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