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
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:
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
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
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
No "isempty/0" ?? `jq 'select(.good-filenames | isempty)' data.jsonl`
Hi, I am fighting with Gemini AI, ChatGPT and Deepseek R1 about this line (and I am not sure whether to ask here or elsewhere)..
Can anybody tell me who is right?
jq 'select(.good-filenames | isempty)' data.jsonl`jq 'select(.good-filenames | isempty)' data.jsonl
jq: error: isempty/0 is not defined at <top-level>, line 1, column 30:
select(.["good-filenames"] | isempty)
^^^^^^^
jq: 1 compile error
For filtering all dicts where the array "good-filenames" is empty. Example:
{
"hash": "835618ffc68bbd70195dc4d189ff2b1f",
"good-filenames": [],
"bad_filenames": [
"stuff.txt"
]
}
# my binaries
> which jq
/home/user1/bin/jq
> /home/user1/bin/jq --version # which I downloaded from https://github.com/jqlang)
jq-1.8.1
From what I got from github (https://github.com/jqlang/jq/releases/tag/jq-1.8.1) there is ONLY `isempty/1` and no `isempty/0`. (looked through the Man pages etc!)
Who is right? The human or the 3 AIs?
https://redd.it/1n7a9em
@r_bash
Hi, I am fighting with Gemini AI, ChatGPT and Deepseek R1 about this line (and I am not sure whether to ask here or elsewhere)..
Can anybody tell me who is right?
jq 'select(.good-filenames | isempty)' data.jsonl`jq 'select(.good-filenames | isempty)' data.jsonl
jq: error: isempty/0 is not defined at <top-level>, line 1, column 30:
select(.["good-filenames"] | isempty)
^^^^^^^
jq: 1 compile error
For filtering all dicts where the array "good-filenames" is empty. Example:
{
"hash": "835618ffc68bbd70195dc4d189ff2b1f",
"good-filenames": [],
"bad_filenames": [
"stuff.txt"
]
}
# my binaries
> which jq
/home/user1/bin/jq
> /home/user1/bin/jq --version # which I downloaded from https://github.com/jqlang)
jq-1.8.1
From what I got from github (https://github.com/jqlang/jq/releases/tag/jq-1.8.1) there is ONLY `isempty/1` and no `isempty/0`. (looked through the Man pages etc!)
Who is right? The human or the 3 AIs?
https://redd.it/1n7a9em
@r_bash
GitHub
jqlang
jqlang has 4 repositories available. Follow their code on GitHub.
I made a AI-powered CLI tool (No api calls) to convert natural language to shell commands
So here’s the thing: when I first started using the terminal, I honestly thought I needed a **PhD in Dark Arts & Arcane Spellcasting** just to do basic stuff.
Like…
>
After googling the *same damn commands* for the **500th time**, I had a thought:
>
So I thought maybe there was a tool that would help beginners and other people through without calling api or anything and should be light weight.
And boom **Shazam** was born (default name is Jarvis but you can call it Friday, Alfred, or even Papi if that’s your vibe).
# What it does:
You type this:
jarvis "change directory to Desktop"
And it prints this into your shell:
cd Desktop/
No ChatGPT API keys, no cloud BS, it runs a local GGUF model under the hood. And its quite light weight. To know more about how it works [click here](https://github.com/Sudheesh-07/shazam/blob/main/MODEL.md). If you want to contribute [repo is here](https://github.com/Sudheesh-07/shazam)
# Stuff I need help with:
* Currently it prints the command not on a readline but just as a output i want it to work on anew readline (I dont really know much about the low level programming to do so PS: codebase is in python)
* Making it play nice on various shells and OSs.
* Packaging it for Homebrew / apt so others can install it without issues.
* Smarter parsing → like remembering your context, chaining commands, etc.
* Basically everything that makes it cooler.
# Stuff that’s already in:
* Works in Bash, and Zsh
* Config file where you can rename your assistant (yes, you can call it Waifu if you want).
* Works througout your device no need to be in the root directory to use
* Can use -r or --run flag to directly execute
[Repo here](https://github.com/Sudheesh-07/shazam)
I legit think this could be a fun open-source project. With a lot of things to make it actually working and useful. So please feel to make contributions and make a great community project.
https://redd.it/1n82hqf
@r_bash
So here’s the thing: when I first started using the terminal, I honestly thought I needed a **PhD in Dark Arts & Arcane Spellcasting** just to do basic stuff.
Like…
>
After googling the *same damn commands* for the **500th time**, I had a thought:
>
So I thought maybe there was a tool that would help beginners and other people through without calling api or anything and should be light weight.
And boom **Shazam** was born (default name is Jarvis but you can call it Friday, Alfred, or even Papi if that’s your vibe).
# What it does:
You type this:
jarvis "change directory to Desktop"
And it prints this into your shell:
cd Desktop/
No ChatGPT API keys, no cloud BS, it runs a local GGUF model under the hood. And its quite light weight. To know more about how it works [click here](https://github.com/Sudheesh-07/shazam/blob/main/MODEL.md). If you want to contribute [repo is here](https://github.com/Sudheesh-07/shazam)
# Stuff I need help with:
* Currently it prints the command not on a readline but just as a output i want it to work on anew readline (I dont really know much about the low level programming to do so PS: codebase is in python)
* Making it play nice on various shells and OSs.
* Packaging it for Homebrew / apt so others can install it without issues.
* Smarter parsing → like remembering your context, chaining commands, etc.
* Basically everything that makes it cooler.
# Stuff that’s already in:
* Works in Bash, and Zsh
* Config file where you can rename your assistant (yes, you can call it Waifu if you want).
* Works througout your device no need to be in the root directory to use
* Can use -r or --run flag to directly execute
[Repo here](https://github.com/Sudheesh-07/shazam)
I legit think this could be a fun open-source project. With a lot of things to make it actually working and useful. So please feel to make contributions and make a great community project.
https://redd.it/1n82hqf
@r_bash
GitHub
shazam/MODEL.md at main · Sudheesh-07/shazam
Shazam is AI-powered CLI tool that converts natural language to bash commands - Sudheesh-07/shazam
What are the most common reasons for a bash shell to get messed up?
Sometimes while scrolling backwards through my history, when I pass through a certain entry, the bash shell gets messed up. I seem to appear my PS1 and PS2 prompt string and the position of the cursor does no longer match if I actually edit a command. If later I watch the history, the edit was done at a different place than where the cursor was at.
Most of the times a reset command helps but not always.
Now I noticed something. The shell where I have the problem is in an i3 desktop that in itself runs in a remote desktop session. When I try to scroll through the exact same history when I SSH to the same host from Terminal.app on my Mac, I don't have the problem.
Might this be related to resizing of windows and the Bash shell not relying on correct information?
https://redd.it/1n829q3
@r_bash
Sometimes while scrolling backwards through my history, when I pass through a certain entry, the bash shell gets messed up. I seem to appear my PS1 and PS2 prompt string and the position of the cursor does no longer match if I actually edit a command. If later I watch the history, the edit was done at a different place than where the cursor was at.
Most of the times a reset command helps but not always.
Now I noticed something. The shell where I have the problem is in an i3 desktop that in itself runs in a remote desktop session. When I try to scroll through the exact same history when I SSH to the same host from Terminal.app on my Mac, I don't have the problem.
Might this be related to resizing of windows and the Bash shell not relying on correct information?
https://redd.it/1n829q3
@r_bash
Timingapp
Time Tracking for Developers — Fully Automated!
See how much time you spend on writing code and other app development tasks. Try our time tracker for programmers free for 30 days, no credit card required.
Any recommended upload/download sites for this subreddit?
I'm currently doing the documentation/readme on my bash implementation of "Conway's Life Game". I don't see an option to upload attachments here. I'm a hobbyist, not a professional, and I have no idea how to set up and maintain a github repository like many people do here for downloading their creations. Is there a recommended site where I can upload a tarball for people to download? Right now I'm looking at approx 82 kbytes, which goes down to approx 16 kbytes as a .tgz file.
https://redd.it/1n8v1q5
@r_bash
I'm currently doing the documentation/readme on my bash implementation of "Conway's Life Game". I don't see an option to upload attachments here. I'm a hobbyist, not a professional, and I have no idea how to set up and maintain a github repository like many people do here for downloading their creations. Is there a recommended site where I can upload a tarball for people to download? Right now I'm looking at approx 82 kbytes, which goes down to approx 16 kbytes as a .tgz file.
https://redd.it/1n8v1q5
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How to Ctrl+C out of a noscript that uses timeout?
I have a file
When I run
https://redd.it/1n9l9en
@r_bash
I have a file
mynoscript with this content:timeout 5 sleep 5
When I run
bash mynoscript and use Ctrl+C, nothing happens. Is there some modification I can make to mynoscript where I can Ctrl+C to end the program before it waits for 5 seconds?https://redd.it/1n9l9en
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
jb: Simple bash environment for Java project
I wrote this because sometimes I just need to whip up a Java application with a *.jar that runs, and:
I just don't have time to fire up Eclipse or IntelliJ;
I might not have graphical access to the system anyways;
I don't always have access to Maven infra;
I can't ever run
This tool is helpful for me, because I tend to mainly do sysadmin work; or I troubleshoot systems that operate across a wide variety of languages and frameworks, or I may lack graphical access or Internet access. So I just need to write an application quickly to validate a concept in Java, or stand it up as a dummy, then move on.
Link: https://git.sr.ht/\~mehdyfaik/jb
https://redd.it/1n9jjyi
@r_bash
I wrote this because sometimes I just need to whip up a Java application with a *.jar that runs, and:
I just don't have time to fire up Eclipse or IntelliJ;
I might not have graphical access to the system anyways;
I don't always have access to Maven infra;
I can't ever run
jar correctly, the first timeThis tool is helpful for me, because I tend to mainly do sysadmin work; or I troubleshoot systems that operate across a wide variety of languages and frameworks, or I may lack graphical access or Internet access. So I just need to write an application quickly to validate a concept in Java, or stand it up as a dummy, then move on.
Link: https://git.sr.ht/\~mehdyfaik/jb
https://redd.it/1n9jjyi
@r_bash