r_bash – Telegram
call function from switch case without double semi colon interference?


customshitkernconfdefaultname="ahh"

mkdir -p /scratch/usr/src/sys/amd/conf/



copy\_kernel\_over() {

cp ../sys/amd64/conf/$customshitkernconfdefaultname /scratch/usr/src/sys/amd64/conf/

echo $customshitkernconfdefaultname

exit

}



change\_default\_kernel\_name() {

read -P "please specify your filename: " $customshitkernconfdefaultname

echo $customshitkernconfdefaultname

exit

}



while true; do

read -p "Want to use default name of kernel conf? Default is named: $customshitkernconfdefaultname " yn

case $yn in

\[Yy\]\* ) copy\_kernel\_over()

\[Nn\]\* ) change\_default\_kernel\_name()

\* ) echo "Please answer y or n" ;;

esac

done



either it complains about ;; is not recognized or missing

https://redd.it/1n4xlfc
@r_bash
Possible to sort a CSV file in numerical order?

I have a CSV that contains a list names in columb 'A' and Age in Columb 'B'.

Is there some way to sort the CSV in age order, low to high?

I thought the following may do it but I get a 'Not an integer' error even though it is. Unless it's treating it as a string and not an integer?

sort -t, -k2n "$workingFolder$inputFile" | \\

Any help greatly received



https://redd.it/1n5ojme
@r_bash
Auto formatting extensionless Bash noscripts with Editorconfig, the Bash language server and its support for shfmt (in Neovim)

That noscript's quite a mouthful, I know; anyway, I was trying to figure out why I was experiencing odd behaviour when using Editorconfig settings with Bash language server with its support for shfmt. I dug around a bit, found some things out, and came up with a solution.

Sharing here in case it helps someone, plus I'm curious to hear if anyone else has come across or tried to get this combination working (or if it's just me being dim)?

Auto formatting extensionless Bash noscripts in Neovim

https://redd.it/1n6cr1b
@r_bash
Made a simple Bash noscript to quickly switch Linux power profiles

Hey everyone,

I recently built a small Bash noscript called Power-CLI for myself. Since I use a WM, switching Linux power modes manually was kind of annoying, so I made a quick terminal tool to toggle between Performance, Balanced, and Power Saver modes — with notifications and sound alerts.

It’s not flashy or overcomplicated, just something that gets the job done. Thought it might be useful for others who want a simple, lightweight solution.

Fun fact: Bash is the first language I’ve learned, and I enjoy building small tools for myself just for fun.

Check it out here: https://github.com/AkshitBanotra/power-cli

https://redd.it/1n6mpbq
@r_bash
A comprehensive Linux guide worth checking out

Hey folks,

If you’re learning Linux or just want a solid reference to keep around, I found The Complete Reference: Linux (6th Edition) super helpful.

It covers everything from the basics to managing users, networks, filesystems, and even configuring Internet services. Honestly, it’s the kind of book you can flip open any time you get stuck.

I’m sharing a free copy here Book

Hopefully it helps someone who’s on their Linux journey

https://redd.it/1n6vzas
@r_bash
Problem with noscript runnign after wake from sleep

Fedora 42 w/ KDE

I have a bash logon noscript that runs a program at login, but I need to do the same thing when I return from sleep. I have created a sh noscript called wakeup_noscript in /usr/lib/systemd/system-sleep/ and made it executable. Sadly, it does not run the program when I return from sleep.

What have I missed here?

#!/bin/sh
case $1 in
post)
/usr/bin/myapplication
;;
esac



https://redd.it/1n6e09e
@r_bash
How to extract block separated by two newlines?

I have a text file. I want to extract the last block separated by two newline chars.

How to do that?

Example:



echo -e 'pre\n\nblock\nfirst\n\npost\n\nblock\nLAST\n\nsomechars'


How to get

block
LAST


?


https://redd.it/1n781cp
@r_bash
Help with bash noscript

Hi everyone, not sure if this is the correct place to ask for this, apologies if it isn't. I'm very new to bash and I'm trying to make a noscript that will scan all .md files in a specified directory (recursively, if possible) and extract all unique written paths (not links!). For example, an md file contains the following:

This is how you change the working directory:

    cd /example/path/foo/bar


So I want the noscript to return the string "/example/path/foo/bar" and which file(s) it was found in. It should ignore links to other files and also URLs. Is this possible? I feel stupid for struggling with this as much as I have

https://redd.it/1n7h1j6
@r_bash