ruby.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
If you are interested in the Ruby programming language, come join us! Tell us about yourself when signing up. If you just want to join Mastodon, another server will be a better place for you.

Administered by:

Server stats:

1.1K
active users

#bash

14 posts13 participants5 posts today

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

With my internal laptop screen below the large external 24" monitor, I always have to tilt my neck unnaturally high whenever I open a new terminal window. This line at the end of my ~/.bashrc now displays the first prompt at the bottom of the terminal, which is usually at eye level:

tput cup 9999 0

(It puts the cursor at line 9999, column 0 of the terminal, which should be large enough for most screens so that it ends up at the bottom.)

Measuring times in bash.

- time: put in front of your command and it spits out some timing millisecond resolution, but you cannot capture the number to use it elsewhere
- starttime=$(date +%s%N) and same for endtime: this is expensive in the millisecond range, because the external command, date is run
- printf "%(%s)T" has only seconds resolution

Now I found "$EPOCHREALTIME". But set LC_NUMERIC=en first or lose.

gnu.org/software/bash/manual/h

www.gnu.orgBash Variables (Bash Reference Manual)Bash Variables (Bash Reference Manual)

I wrote a little helper function to quickly handle Bash jobs.

Because typing out `jobs` and `fg %1` quickly gets tedious.

Now I can just run `j` and press one or two keys to bring a job to the foreground or background.

codeberg.org/selfawaresoup/con

Reminder: don't tell me about screen, tmux, etc. I already know.

Summary card of repository selfawaresoup/configurations
Codeberg.orgconfigurations/bash_includes/functions.sh at mainconfigurations - glorified dotfiles

Yes you have seen it correctly, I'm now including __links__ the sh & console based browser, in my workflow, since it uses few resources, doesn't understand many of the modern languages, which results in pleasure and fun on the internet. You can even use links on a serial console like my Wyse terminal!

An Adblock is not need in this modus operandi.

The places which are properly coded, do not need even JavaScript are where I frequently get my information from

🌘 GitHub - lsferreira42/bash-ini-parser: Bash INI 解析器函式庫
➤ Bash INI 檔案處理的強大工具
github.com/lsferreira42/bash-i
這個 GitHub 倉庫提供了一個強大的 Bash 腳本函式庫,用於解析和操作 INI 格式的設定檔。它提供了豐富的功能,包括讀寫值、列出區塊和鍵、新增/更新/移除區塊和鍵、支援複雜值(如引號、空格和特殊字元)、陣列支援、檔案匯入/匯出、錯誤處理和除錯模式等。這個函式庫易於安裝和使用,僅需在腳本中引入 `lib_ini.sh` 即可。
+ 這對需要用 Bash 腳本處理設定檔的人來說,簡直是救星!以前都要自己寫一堆複雜的邏輯,現在有了這個函式庫,簡潔多了。
+ 很好,支援陣列和匯入匯出功能,讓設定檔的管理更加方便。而且還有安全方面的加強,讓人用得放心。
#開源軟體 #Bash #INI #函式庫

Bash INI Parser Library. Contribute to lsferreira42/bash-ini-parser development by creating an account on GitHub.
GitHubGitHub - lsferreira42/bash-ini-parser: Bash INI Parser LibraryBash INI Parser Library. Contribute to lsferreira42/bash-ini-parser development by creating an account on GitHub.

This Saturday as part of the Everyday Algorithms exhibition: Reimagine your relationship with machines in this workshop to produce queer love letters using Bash scripting with @siusoon and Mara Karagianni. 💌

📅 Saturday 5 April
⏰ 12pm — 3pm
📍The NewBridge Project, #Newcastle upon Tyne, NE2 1AL

This workshop aims to challenge the gender norms in free software development. We will begin with a cultural introduction to Unix and #Bash, exploring how they interact with the operating system. Bash, a command line interface and scripting language created in 1989 for UNIX Systems, is useful for system administration and automation. 💾

During the workshop, you will use the terminal, either in pairs, in groups, or individually, to write and create a #queer love letter in Bash. These letters will explore various forms of desire, intimacy, and struggle, allowing us to reimagine what our relationship with the machines we use might look like. ❤️‍🔥

Free, booking is essential: thenewbridgeproject.com/events

셸 언어는 때로 추하길 요구 받는다

hackers.pub/@hongminhee/2025/s

Hackers' Pub · 셸 언어는 때로 추하길 요구 받는다명령줄 인터페이스(CLI)는 컴퓨터와 상호작용하는 가장 오래된 방식 중 하나다. 그리고 이 인터페이스를 지배하는 것은 셸 언어다. 그런데 흥미로운 점은 셸 언어가 일반적인 프로그래밍 언어들과는 상당히 다른 설계 철학을 따른다는 것이다. 한 마디로 요약하자면, 셸 언어는 때로 “추함”을 받아들여야 한다.간결함의 미학 Bash나 zsh와 같은 전통적인 셸을 보자. grep -r "error" /var/log | wc -l와 같은 명령은 암호처럼 보일 수 있지만, 타이핑하는 데 몇 초밖에 걸리지 않는다. 이러한 간결함은 우연히 생긴 것이 아니다. 셸 환경에서는 사용자가 빠르게 입력하고, 결과를 확인하고, 다시 명령을 수정하는 반복적인 워크플로우가 일반적이다. 여기서 핵심은 “대화형” 경험이다.PowerShell의 딜레마 PowerShell은 마이크로소프트가 셸의 개념을 재정의하려 한 야심찬 시도였다. 객체 지향적 파이프라인, 일관된 동사–명사 구문, 그리고 자세한 매개변수 이름 등은 모두 코드의 가독성과 유지보수성을 높이기 위한 설계였다. 그러나 다음 명령을 비교해보자: Bash:find . -name "*.log" -mtime -7 \ | xargs grep "error" \ | sort \ | uniq -c<PowerShell:Get-ChildItem -Path . -Filter *.log ` | Where-Object {$_.LastWriteTime -gt (Get-Date).AddDays(-7)} ` | ForEach-Object {Select-String -Path $_.FullName -Pattern "error"} ` | Sort-Object ` | Group-Object ` | Select-Object Name,Count<PowerShell의 명령은 더 명확하고 자기 설명적이지만, 대화형 셸에서 빠르게 실험하고 반복하기에는 너무 장황하다. PowerShell 설계자들은 “추함”을 견디지 못하고 너무 많은 “다림질”을 해버린 것이다.균형점 찾기 흥미롭게도 최근의 Nushell 같은 현대적인 셸은 이 교훈을 받아들이고 있다. 구조화된 데이터 처리와 같은 PowerShell의 장점을 가져오면서도, 대화형 사용에 필요한 간결함을 유지하려 노력한다. 셸 언어의 진정한 성공은 “아름다운 코드”와 “효율적인 상호작용” 사이의 균형에 달려 있다. 이는 때로 완벽한 문법이나 일관성보다는 실용적인 “추함”을 수용해야 함을 의미한다.결론 프로그래밍 언어의 세계에서는 우아함과 일관성이 미덕이다. 그러나 셸의 세계에서는 타이핑 효율성, 속도, 그리고 대화형 적합성이 우선시된다. 이것이 바로 셸 언어가 때로 “추함”을 요구받는 이유다. PowerShell의 제한적인 성공은 이 기본적인 진실을 간과한 데서 비롯된 것일지도 모른다. 그리고 어쩌면 이것은 소프트웨어 설계 전반에 걸친 더 깊은 교훈을 담고 있다: 모든 도구는 그 사용 맥락에 맞게 설계되어야 한다는 것이다. 셸 언어에서는 그 맥락이 바로 키보드와 사용자 사이의 빠른 대화다.