Are there any real alternatives to shfmt?
Not that I complain, but as the formatting options of `shfmt` are rather limited, I wonder what other alternatives there are. I struggled to find anything similarly universal that is being actively maintained.
Something that is not strictly limited to a specific editor, ideally respecting `.editorconfig` already in place in the project.
https://redd.it/1n4ah9r
@r_bash
Not that I complain, but as the formatting options of `shfmt` are rather limited, I wonder what other alternatives there are. I struggled to find anything similarly universal that is being actively maintained.
Something that is not strictly limited to a specific editor, ideally respecting `.editorconfig` already in place in the project.
https://redd.it/1n4ah9r
@r_bash
GitHub
GitHub - mvdan/sh: A shell parser, formatter, and interpreter with bash support; includes shfmt
A shell parser, formatter, and interpreter with bash support; includes shfmt - mvdan/sh
redirected output does not update
On an old xfce (xubuntu) machine, I'm running a python noscript in a terminal window:
python3 my_noscript.py &> my_noscript.log
and trying to monitor the process with:
tail -f my_noscript.log
The buffering/flushing behaviour is very strange. The noscript has been running for half an hour and should have produced at least 300 lines of output, but the file size of the log was still 0 until I manually ended the noscript.
I've already tried this:
stdbuf -oL python3 my_noscript.py &> my_noscript.log
It doesn't change a thing. So far, output has only been written at the end, but not before that.
What could be the reason for that and is there a quick and easy way to change it?
https://redd.it/1n4w0iz
@r_bash
On an old xfce (xubuntu) machine, I'm running a python noscript in a terminal window:
python3 my_noscript.py &> my_noscript.log
and trying to monitor the process with:
tail -f my_noscript.log
The buffering/flushing behaviour is very strange. The noscript has been running for half an hour and should have produced at least 300 lines of output, but the file size of the log was still 0 until I manually ended the noscript.
I've already tried this:
stdbuf -oL python3 my_noscript.py &> my_noscript.log
It doesn't change a thing. So far, output has only been written at the end, but not before that.
What could be the reason for that and is there a quick and easy way to change it?
https://redd.it/1n4w0iz
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
call function from switch case without double semi colon interference?
either it complains about ;; is not recognized or missing
https://redd.it/1n4xlfc
@r_bash
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
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
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
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
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
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
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
DJ Adams
Auto formatting extensionless Bash noscripts in Neovim
Here's what I did to make the combination of the Bash language server and shfmt work with Editorconfig settings for Bash noscript files that don't have extensions.
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
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
GitHub
GitHub - AkshitBanotra/power-cli: Quickly manage power profiles from the terminal with a simple Bash noscript.
Quickly manage power profiles from the terminal with a simple Bash noscript. - AkshitBanotra/power-cli
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
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
GitHub
GitHub - Avinashabroy/Linux-Book-
Contribute to Avinashabroy/Linux-Book- development by creating an account on GitHub.
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
What have I missed here?
#!/bin/sh
case $1 in
post)
/usr/bin/myapplication
;;
esac
https://redd.it/1n6e09e
@r_bash
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
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
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:
How to get
?
https://redd.it/1n781cp
@r_bash
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
Reddit
From the bash community on Reddit
Explore this post and more from the bash community