Wrote a #shell function without using ls inside of $( ), so my inner @mirabilos won't harass me. XD

#slightly easier wireguard command function wg { local dir file profile profiledir= parm=${1:-} statustext #Find profile dir for dir in {,/usr/local}/etc/wireguard; do if [[ -d $dir ]]; then profiledir=$dir break fi done #Find config file if [[ -n $profiledir ]]; then for file in $profiledir/*.conf; do if [[ -e $file ]]; then profile=${file//*\/} profile=${profile/.conf} break fi done fi [[ -n $profile ]] || profile=proton statustext="wireguard profile $profile" case ${parm,,} in up|on) doas wg-quick up $profile;; down|off) doas wg-quick down $profile;; status) echo -en "$statustext _______\r" echo -en "$statustext " ifconfig |grep -q "^$profile:" && echo enabled || echo disabled;; *) warn "wg usage: wg up|down|status";; esac }

Hmm, seems ${foo,,} for lower case conversion is #bash-only. I wonder if I should use tr instead.

#Unix #UnixShell #ShellScript #ShellScripting

シェルスクリプトでgetoptsを使ったことなかったので調べてみた - Qiita

getoptsはBashのシェルスクリプト内で引数解析ができる組み込みコマンドです。 manコマンドの内容を抜粋してみると以下のようになっています。 manコマンド抜粋 getopts optstring name [arg ...] getopts is used b...

Qiita

Since #Codeberg broke my #ShellScript after they did what they did with their stupid website trying to catch bots, I edited the script to remove the downloading piece.

I have to manually download the files I need, but the script still takes care of the rest.

"Just add hot water and Mr Tea does the rest." --Father Guido Sarducci (Don Novello)

Ah, it seems my Google-foo is strong. I think I found a modified #Automator #ShellScript to not add the line feed.

Any #Automator #ShellScript experts care to help?

I created the following script to copy the first 6 characters of a selected filename to the clipboard. But the clipboard item ends up with a hard return after the characters. Is there a way to put a stop to that?

🤦‍♂️ Ah yes, #Linux is an #interpreter now. Because who needs a perfectly functional kernel when you can make an OS behave like a wannabe shell script interpreter? 👻 Fear not, dear reader, the author promises you an inscrutable command that might just be #malware, but hey, that’s all part of the #fun, right? 🐔
https://astrid.tech/2026/03/28/0/linux-is-an-interpreter/ #ShellScript #HackerNews #ngated
Linux is an interpreter

And why you would want to exec a cpio

astrid dot tech

Mi skribis unu simpla #ShellScript por fari elŝuti de ĉiu senpaga #RaspberryPi revuoj de oficiala retejo.

Kiuj posedas intereso en uzi ĝi, povas recevi ĝi en: https://github.com/A-Infor/Shell-Scripts

Here's a little puzzle for you. Can you figure out the purpose of this one-off shell script I just wrote?
If you post an answer put it behind a CW so you don't spoil it for others!
#programming #scripting #shellScript #shellScripting #Linux
Bash Via Transpiler

It is no secret that we often use and abuse bash to write things that ought to be in a different language. But bash does have its attractions. In the modern world, it is practically everywhere. It …

Hackaday