Run multiple bash commands using text-only based on GPT-5.2
https://github.com/matank001/OsDevil
https://redd.it/1plxjlz
@r_bash
https://github.com/matank001/OsDevil
https://redd.it/1plxjlz
@r_bash
GitHub
GitHub - matank001/OsDevil: OsDevil is a lightweight AI agent that converts natural language into operating system commands, enabling…
OsDevil is a lightweight AI agent that converts natural language into operating system commands, enabling automation across development, operations, and DevSecOps workflows - matank001/OsDevil
Automate the initial creation process of your bash noscript
Tired of the initial hassle of creating a Bash noscript—like making the file readable and executable? If so, this tool is for you.
https://github.com/Keys02/noscriptify
PS: noscriptify also adds the shebang line.
All contributions are welcome
https://redd.it/1pm5vaw
@r_bash
Tired of the initial hassle of creating a Bash noscript—like making the file readable and executable? If so, this tool is for you.
https://github.com/Keys02/noscriptify
PS: noscriptify also adds the shebang line.
All contributions are welcome
https://redd.it/1pm5vaw
@r_bash
GitHub
GitHub - Keys02/noscriptify: Scriptify is a utility which gits rid of the friction between creating your bash noscript and actually…
Scriptify is a utility which gits rid of the friction between creating your bash noscript and actually writing it. - Keys02/noscriptify
Concurrent, parallel, or simultaneous?
I frequently write noscripts that should only have 1 instance running at a time. For instance, a noscript that copies a MySQL table from 1 host to another.
I implement this with a snippet like:
Would you consider the second instance of this noscript to be concurrent, parallel, or simultaneous?
https://redd.it/1pmte90
@r_bash
I frequently write noscripts that should only have 1 instance running at a time. For instance, a noscript that copies a MySQL table from 1 host to another.
I implement this with a snippet like:
# prevent simultaneous execution
pids=$(pidof -o '%PPID' -x "$(basename "$0")")
if [[ -n "${pids}" ]]
then
echo "$(basename $0) (${pids}) is already running."
exit
fi
Would you consider the second instance of this noscript to be concurrent, parallel, or simultaneous?
https://redd.it/1pmte90
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Bash noscript for docker monitoring
I wanted to monitor and manage docker containers on a few servers. All the solutions I found were either heave or were missing things which I wanted so I started developing my own bash noscript - it started as a simple noscript but after many imitations and improvements based on usage it has become a real helpful tool.
Just wanted to share here in appreciation of Bash - there is so much which I did not even know can be done with simply bash noscripting.
https://github.com/buildplan/container-monitor
https://redd.it/1pnlqlx
@r_bash
I wanted to monitor and manage docker containers on a few servers. All the solutions I found were either heave or were missing things which I wanted so I started developing my own bash noscript - it started as a simple noscript but after many imitations and improvements based on usage it has become a real helpful tool.
Just wanted to share here in appreciation of Bash - there is so much which I did not even know can be done with simply bash noscripting.
https://github.com/buildplan/container-monitor
https://redd.it/1pnlqlx
@r_bash
GitHub
GitHub - buildplan/container-monitor: Monitoring noscript for Docker containers - checks and updates containers, Shows logs and filter…
Monitoring noscript for Docker containers - checks and updates containers, Shows logs and filter errors etc. - buildplan/container-monitor
change color in css file (working)
i have this simple bash file, to run you do for example "./test.sh accent \\#ffffff", but i want to merge the functions into one. how to do this?
https://preview.redd.it/87w1mp1q6g7g1.png?width=1281&format=png&auto=webp&s=c510c57cc1727e1e94613841bb6dd5281da41d74
https://redd.it/1pnloa1
@r_bash
i have this simple bash file, to run you do for example "./test.sh accent \\#ffffff", but i want to merge the functions into one. how to do this?
https://preview.redd.it/87w1mp1q6g7g1.png?width=1281&format=png&auto=webp&s=c510c57cc1727e1e94613841bb6dd5281da41d74
https://redd.it/1pnloa1
@r_bash
Isn't this the greatest BASH course ever?
https://www.youtube.com/watch?v=Sx9zG7wa4FA : YSAP
The way this guy explains concepts with depth and clarity in it is insane. The fact that he self-learnt everything through man pages is something which keeps me driven in tech.
https://redd.it/1po23s0
@r_bash
https://www.youtube.com/watch?v=Sx9zG7wa4FA : YSAP
The way this guy explains concepts with depth and clarity in it is insane. The fact that he self-learnt everything through man pages is something which keeps me driven in tech.
https://redd.it/1po23s0
@r_bash
YouTube
The Complete Bash Scripting Course - Full Length Guide to learning the Bash Shell
Bash noscripting course and guide created by Dave Eddy of ysap.sh. Learn the Bash Shell and master beginner all the way up to advanced Bash noscripting techniques. Check out the course website below for all materials, source code, referenced material, etc. for…
Asking for help with a command launcher noscript
I'd like to ask a question about an automation strategy which has eluded me.
# What I'm trying to do
I'd like to have a noscript which:
1. can launch a new terminal emulator
2. then run a login shell in the terminal emulator (with all my personal shell initialization)
3. can then run an arbitrary program or command of my choosing
4. then on completion or termination of the program the shell stays alive and interactive
5. also the arbitrary command is added to shell history
Hopefully I explained that well.
Unfortunately something like
With the above the terminal is closed after program completion and is not run with shell initialization (login shell).
I'll share my solution, but I'm curious if there is an easier way to accomplish the same:
# Current Solution
I also put the code in this repo
I add the following to the end my
if [ -n ${INIT_CMD} ]; then
print -s "${INITCMD}"
eval "${INITCMD}"
unset INITCMD
fi
then to launch programs I use something like:
#!/usr/bin/env bash
# terminal='alacritty'
# terminal='ghostty'
# terminal='st'
terminal='kitty'
${terminal} -e $SHELL \
-c 'INITCMD="echo hello" $SHELL'
where
Which does require starting up two shells, however, the first shell with
Thanks in advance if you know a simpler way to accomplish this!
https://redd.it/1po6z4y
@r_bash
I'd like to ask a question about an automation strategy which has eluded me.
# What I'm trying to do
I'd like to have a noscript which:
1. can launch a new terminal emulator
2. then run a login shell in the terminal emulator (with all my personal shell initialization)
3. can then run an arbitrary program or command of my choosing
4. then on completion or termination of the program the shell stays alive and interactive
5. also the arbitrary command is added to shell history
Hopefully I explained that well.
Unfortunately something like
alacritty -e bash -c 'echo hello' does not fulfill these requirements. With the above the terminal is closed after program completion and is not run with shell initialization (login shell).
I'll share my solution, but I'm curious if there is an easier way to accomplish the same:
# Current Solution
I also put the code in this repo
I add the following to the end my
~/.bashrcif [ -n ${INIT_CMD} ]; then
print -s "${INITCMD}"
eval "${INITCMD}"
unset INITCMD
fi
then to launch programs I use something like:
#!/usr/bin/env bash
# terminal='alacritty'
# terminal='ghostty'
# terminal='st'
terminal='kitty'
${terminal} -e $SHELL \
-c 'INITCMD="echo hello" $SHELL'
where
echo hello is the "program"Which does require starting up two shells, however, the first shell with
-c flag is cheap. The second shell is the login shell.Thanks in advance if you know a simpler way to accomplish this!
https://redd.it/1po6z4y
@r_bash
GitHub
GitHub - nanvenomous/command_launcher
Contribute to nanvenomous/command_launcher development by creating an account on GitHub.
How to check if $var is in a list?
Imagine you have:
How can you check if
I don't want to write a loop for that :-)
https://redd.it/1ppmxqf
@r_bash
Imagine you have:
mylist=("foo" "bar" "baz")
How can you check if
$var is in mylist?I don't want to write a loop for that :-)
https://redd.it/1ppmxqf
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Bash Trek: TNG, an Update to a Retro Terminal Game
One or two attentive readers may recall that a couple of months ago, I posted about a Bash version of the old Star Trek terminal game that I'd written, called Bash Trek.
Well - I've adapted it into a new implementation, Bash Trek: TNG which replaces the old typed command interface with mouse control.
Mouse reporting is an underused thing, I think. It's not hard to build simple menus or buttons for simple terminal applications.
https://preview.redd.it/uj9z4g3za18g1.png?width=708&format=png&auto=webp&s=4baa2d60360563fe9c27a2afc6c9f1fb0dd78d5d
https://preview.redd.it/gxmif3e0b18g1.png?width=708&format=png&auto=webp&s=1c685b49377dfcc68684033c7da5397618f2a346
Anyway: if interested, https://github.com/StarShovel/bash-trek-tng
https://redd.it/1pq3ihb
@r_bash
One or two attentive readers may recall that a couple of months ago, I posted about a Bash version of the old Star Trek terminal game that I'd written, called Bash Trek.
Well - I've adapted it into a new implementation, Bash Trek: TNG which replaces the old typed command interface with mouse control.
Mouse reporting is an underused thing, I think. It's not hard to build simple menus or buttons for simple terminal applications.
https://preview.redd.it/uj9z4g3za18g1.png?width=708&format=png&auto=webp&s=4baa2d60360563fe9c27a2afc6c9f1fb0dd78d5d
https://preview.redd.it/gxmif3e0b18g1.png?width=708&format=png&auto=webp&s=1c685b49377dfcc68684033c7da5397618f2a346
Anyway: if interested, https://github.com/StarShovel/bash-trek-tng
https://redd.it/1pq3ihb
@r_bash
Little help needed! sometimes this noscript exits after the first line
the argument in the first line is a youtube video url or channel url. It downloads the id of the video/videos. Sometimes the code exits here, other times it actually goes to the other lines.
the second line is to filter out duplicate lines. Video ids are uniq, but if you run the code again, it just appends the ids to 'ids.txt'
the third line sorts ids.txt in reverse order. I then use the ids to download video urls in the fourth line. Please help me out. I would also appreciate if you help improve the noscript in other areas. I would like to add a padding of 5 to the output filenames, so that 1.jpg becomes 00001.jpg and 200.jpg becomes 00200.jpg
Thank you very much in advance
https://redd.it/1pqloym
@r_bash
#!/bin/bashyt-dlp --skip-download --flat-playlist --print-to-file id 'ids.txt' $1 awk '!seen[$0]++' ids.txt | tee ids.txtawk '{print NR, $0 }' ids.txt | sort -rn | awk '{print $2}' > ids.logawk '{print "wget `http://img.youtube.com/vi/"$1"/mqdefault.jpg` -O "NR".jpg"}' ids.logthe argument in the first line is a youtube video url or channel url. It downloads the id of the video/videos. Sometimes the code exits here, other times it actually goes to the other lines.
the second line is to filter out duplicate lines. Video ids are uniq, but if you run the code again, it just appends the ids to 'ids.txt'
the third line sorts ids.txt in reverse order. I then use the ids to download video urls in the fourth line. Please help me out. I would also appreciate if you help improve the noscript in other areas. I would like to add a padding of 5 to the output filenames, so that 1.jpg becomes 00001.jpg and 200.jpg becomes 00200.jpg
Thank you very much in advance
https://redd.it/1pqloym
@r_bash
Why doesn't closing this program's stdout not cause a pipeline to finish?
I'm seeing something strange.
This command:
dd if=/dev/zero bs=1024k count=256 | gprog --size-estimate $((1024*1024*256)) | sha256sum
...produces a sha256, when gprog closes its stdout.
This command:
gprog-du-tar --directories /usr | sha256sum
...does not produce a sha256 when gprog closes its stdout. Instead, it waits until gprog's GUI is shut down, well after gprog closes its stdout.
gprog itself is a python noscript, and can be found at:
https://stromberg.dnsalias.org/svn/gprog/trunk/gprog
gprog-du-tar is a bash noscript that wraps gprog, and can be found at:
https://stromberg.dnsalias.org/svn/gprog/trunk/gprog-du-tar
I suspect the problem isn't particularly related to gprog, since that same command exhibits such different behavior when run by itself at a bash prompt, vs. run inside a shell noscript: gprog-du-tar.
So you don't need to visit those links above (in case you'd rather not), here's gprog-du-tar's content:
Any suggestions? I'm a bit baffled by why the same program would give such a different result based on how its run.
https://redd.it/1pqz5nj
@r_bash
I'm seeing something strange.
This command:
dd if=/dev/zero bs=1024k count=256 | gprog --size-estimate $((1024*1024*256)) | sha256sum
...produces a sha256, when gprog closes its stdout.
This command:
gprog-du-tar --directories /usr | sha256sum
...does not produce a sha256 when gprog closes its stdout. Instead, it waits until gprog's GUI is shut down, well after gprog closes its stdout.
gprog itself is a python noscript, and can be found at:
https://stromberg.dnsalias.org/svn/gprog/trunk/gprog
gprog-du-tar is a bash noscript that wraps gprog, and can be found at:
https://stromberg.dnsalias.org/svn/gprog/trunk/gprog-du-tar
I suspect the problem isn't particularly related to gprog, since that same command exhibits such different behavior when run by itself at a bash prompt, vs. run inside a shell noscript: gprog-du-tar.
So you don't need to visit those links above (in case you'd rather not), here's gprog-du-tar's content:
#!/bin/bash# this is far from a perfect estimate, but it's usually pretty decentfunction usage { retval="$1" case "$retval" in 0) ;; *) exec 1>&2 ;; esac echo "Usage: $0"echo "--directories A list of directories to du and tar - must be the last option" echo "--help This stuff" echo echo "Tar up a local directory hierarchy and pipe it through gprog, using du to get an estimate of how much data will need" echo "to be copied." exit "$retval" }while [ "$#" -ge 1 ] do if [ "$1" = --directories ] then shift break elif [ "$1" = --help ] then usage 0 else echo "$0: Illegal option: $1" 1>&2 usage 1 fishift doneif type -path gtar > /dev/null 2>&1 then tar=gtar else tar=tar fiestimate=$(for i in "$@" do du -skx "$i" done | \ count -c | \ python3 -c ' import sys total = 0 for line in sys.stdin: total += int(line.split()[0]) * 1024 print(total)')echo "Estimate: $estimate bytes" 1>&2"$tar" --create --sparse --one-file-system "$@" | gprog --size-estimate "$estimate" --noscript "gprog-du-tar $*"Any suggestions? I'm a bit baffled by why the same program would give such a different result based on how its run.
https://redd.it/1pqz5nj
@r_bash
what is the best way to measure the time of a command ?
i wana measure the time of `python3 prog.py< in >out`
i know how to do that in c/c++ but i don't wana overhead
so what is the best way to do that in the terminal ?
(in milliseconds)
thanks
https://redd.it/1ps5gju
@r_bash
i wana measure the time of `python3 prog.py< in >out`
i know how to do that in c/c++ but i don't wana overhead
so what is the best way to do that in the terminal ?
(in milliseconds)
thanks
https://redd.it/1ps5gju
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
I built a terminal-native SQL playground to understand DBMS internals better
https://github.com/tejgokani/TermiBase
https://redd.it/1psb88v
@r_bash
https://github.com/tejgokani/TermiBase
https://redd.it/1psb88v
@r_bash
GitHub
GitHub - tejgokani/TermiBase: TermiBase — a terminal-native SQL playground that visualizes how queries are parsed, planned, and…
TermiBase — a terminal-native SQL playground that visualizes how queries are parsed, planned, and executed, built to teach DBMS internals through hands-on interaction - tejgokani/TermiBase