Tested with Slackware-current. You can create and access the chroot easily with just a few commands.
Source:
https://git.sr.ht/~r1w1s1/slackbuilds/blob/main/chroot-manager.sh
#slackware #shellscript #chroot #Linux
Tracing the #!: How the Linux Kernel Handles the Shebang - One of the delights in Bash, zsh, or whichever shell tickles your fancy in your OS... - https://hackaday.com/2025/04/11/tracing-the-how-the-linux-kernel-handles-the-shebang/ #linuxkernel #shellscript #linuxhacks
A 6502, In The Shell - Shell scripting is an often forgotten programming environment, relegated to simple... - https://hackaday.com/2025/03/17/a-6502-in-the-shell/ #microcontrollers #softwarehacks #shellscript #linuxhacks #shell
How To Replace Text In Multiple Files Using A Bash Script In Linux #Bash #ShellScript #Linux #Linuxcommands #Linuxhowto #Linuxbasics
https://ostechnix.com/replace-text-in-multiple-files-using-bash-script/
Linux Fu: Use the Source (Command), Luke - You can argue if bash is a good programming language or not, but you can’t argue t... - https://hackaday.com/2025/03/13/linux-fu-use-the-source-command-luke/ #hackadaycolumns #shellscript #linuxhacks #linux #bash
Gotta say, I wish #bash had local
/ lexically-scoped functions, rather than having to rely on hacks like:
function widget {
function ___widget_parse {
...
}
...
unset ___widget_parse
}
Something like this (which does not currently work) would be lovely:
function widget {
local function parse {
...
}
}
How to Use the declare Command in Bash Scripts #declare #Bashscripting #Shellscript #Bash #Linux #Linuxcommands #Linuxhowto #Variables #Functions
https://ostechnix.com/bash-declare-command-usage/
@NOISEBOB #HowTo run #ShellScript when sound in mic
Here is a #bash function "getvol" which uses #SoX to listen for 0.1 second and then tells you peak volume, between 0 and 1:
function getvol {
rec -p trim 0 .1 stat 2>&1 >/dev/null | grep -Po "(?<=Maximum amplitude:).*" | grep -Po "\S+"
}
You can loop the function and do something if the volume is high enough.
#genuary7 in the bash mountains... #bash #shellscript #genuary #genuary2025 - software not intended to create art.
Quick Tip: Which USB devices are currently attached? https://sixcolors.com/post/2025/01/quick-tip-which-usb-devices-are-currently-attached/ from @jsnell @jsnell #Mac #unix #shellscript
Dear lazyweb, does anyone have a good shell script to tail -F the contents of a file and only do something with the latest complete paragraph, and keep monitoring forever, but take no action if it is not yet a complete paragraph.
sed
: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html$( ... )
for command replacement instead of only backticks. #FreeBSD's /bin/sh
is (AFAIK) POSIX compliant, but I'd assume even this shell can do a few things not specified in POSIX. For testing, I found shells/bosh
very useful, it contains a few flavors of minimal shells, one of them a POSIX shell.sh
doesn't know them with the single exception of the "argv" array (both for the main script and any shell function), which you can also modify using set
, but that of course has other implications. What's always available is word splitting, any variable can contain a list separated by whatever $IFS
is set to. It defaults to whitespace. You may override $IFS
, but that can be tricky as well, word splitting is used a lot, so expect surprising effects. Pythonのshというライブラリを使うと、`sh.ls("-la")`みたいな感じにPythonプログラムからコマンドが実行できる。これ、いいですね #python #shellscript
sh — sh 2.0.6 documentation: https://sh.readthedocs.io/en/latest/
Today in "this should not have been a #ShellScript": https://github.com/DrHyde/shellscripts/blob/master/check-encoding
The #shenanigans around the invocation of #iconv are for portability (some versions of it DIE if you silence STDOUT the normal way by redirecting it to /dev/null) and then once it was a three line script I thought "wouldn't it be nice if it took arguments, and had doco, and handled errors", and at no point was solving the next little problem enough to make me re-write it in a better language, and then ... 1/2
Learning about making and creating and checking checksums in bash scripts to compare files.
Have always loved bash scripting… I am *sure* there is a much more elegant way to do this, but it's a start.
I love the very direct impacts of scripting things... 'make it do this'.... and computer dutifully complies. Including when you unintentionally tell it to do something stupid/destructive. lol.
@Siph really hope my adduser #shellscript survives this
All I can say in the Rust for #Linux debacle is: fuck both C and Rust. #shellscript supremacy!
Interesting coding idea for a nice afternoon while waiting for things to reboot, inspired by a post by @starlabssystems
https://codeberg.org/pswilde/FediFollowyCounty
Gets your current follower count, and sticks it in a csv file you can then use in... well... anything you like, #Grafana for example, or #PowerBI (ha) to track follower changes over time
Getting Linux Process List Without Forking Using Just a Bash Script - The ps command is extremely useful when you want to get some quick information on ... - https://hackaday.com/2024/07/29/getting-linux-process-list-without-forking-using-just-a-bash-script/ #softwarehacks #shellscript #how-to #bash