why?
First git pull --rebase and then git push. Why use rebase instead of a normal merge? What are the risks if there are conflicts?
https://redd.it/1o0vvm1
@r_bash
First git pull --rebase and then git push. Why use rebase instead of a normal merge? What are the risks if there are conflicts?
https://redd.it/1o0vvm1
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Rename files with inconsistent field separators
Scenario: directories containing untagged audio files, all files per dir follow the same pattern:
artist - album with spaces - 2-digit-tracknum noscript with spaces
The use of " " instead of " - " for the final separator opens my rudimentary ability to errors.
Will someone point me towards learning how to process these files in a way that avoids falses? I.E. how to differentiate [the space that immediately follows a two-digit track number] from [other spaces [including any other possible two-digits in other fields]].
This is as far as I have gotten:
for file in *.mp3
do
art=$(echo "$file" | sed 's,\ \-\ ,\n,g' | sed -n '1p')
alb=$(echo "$file" | sed 's,\ \-\ ,\n,g' | sed -n '2p')
tn=$(echo "$file" | sed 's,\ \-\ ,\n,g' | sed -n '3p' | sed 's,\ ,\n,' | sed -n '1p')
titl=$(echo "$file" | sed 's,\ \-\ ,\n,g' | sed -n '3p' | sed 's,\ ,\n,' | sed -n '2p')
echo mv "$file" "$art"_"$alb"_"$tn"_"$titl"
done
Thanks.
https://redd.it/1o10dff
@r_bash
Scenario: directories containing untagged audio files, all files per dir follow the same pattern:
artist - album with spaces - 2-digit-tracknum noscript with spaces
The use of " " instead of " - " for the final separator opens my rudimentary ability to errors.
Will someone point me towards learning how to process these files in a way that avoids falses? I.E. how to differentiate [the space that immediately follows a two-digit track number] from [other spaces [including any other possible two-digits in other fields]].
This is as far as I have gotten:
for file in *.mp3
do
art=$(echo "$file" | sed 's,\ \-\ ,\n,g' | sed -n '1p')
alb=$(echo "$file" | sed 's,\ \-\ ,\n,g' | sed -n '2p')
tn=$(echo "$file" | sed 's,\ \-\ ,\n,g' | sed -n '3p' | sed 's,\ ,\n,' | sed -n '1p')
titl=$(echo "$file" | sed 's,\ \-\ ,\n,g' | sed -n '3p' | sed 's,\ ,\n,' | sed -n '2p')
echo mv "$file" "$art"_"$alb"_"$tn"_"$titl"
done
Thanks.
https://redd.it/1o10dff
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Check my timestamp check please
Hi,
I need to check how dumb I am.
I have files arriving every day and I have some checks running on those files named FILENAMEXYZ_timestamp.csv with the current date timestamp.
ls $DIR/FILE*$(date '+%y%m%d')*
I don't need the $ do I? I'm currently checking for a file containing a string contained in the variable named <timestamp>, aren't I?
https://redd.it/1o1bbg9
@r_bash
Hi,
I need to check how dumb I am.
I have files arriving every day and I have some checks running on those files named FILENAMEXYZ_timestamp.csv with the current date timestamp.
ls $DIR/FILE*$(date '+%y%m%d')*
I don't need the $ do I? I'm currently checking for a file containing a string contained in the variable named <timestamp>, aren't I?
https://redd.it/1o1bbg9
@r_bash
Is Bash programming?
Since I discovered termux I have been dealing with bash, I have learned variables, if else, elif while and looping in it, environment variables and I would like to know some things
1 bash is a programming language (I heard it is (sh + noscript)
----
Is 2 bash an interpreter? (And what would that be?)
----
3 What differentiates it from other languages?
----
Is 4 bash really very usable these days? (I know the question is a bit strange considering that there is always a bash somewhere but it would be more like: can I use bash just like I use python, C, Java etc?)
-------
5 Can I make my own bash libraries?
------
Bash is a low or high level language (I suspect it is low level due to factors that are in other languages and not in bash)
https://redd.it/1o2le8n
@r_bash
Since I discovered termux I have been dealing with bash, I have learned variables, if else, elif while and looping in it, environment variables and I would like to know some things
1 bash is a programming language (I heard it is (sh + noscript)
----
Is 2 bash an interpreter? (And what would that be?)
----
3 What differentiates it from other languages?
----
Is 4 bash really very usable these days? (I know the question is a bit strange considering that there is always a bash somewhere but it would be more like: can I use bash just like I use python, C, Java etc?)
-------
5 Can I make my own bash libraries?
------
Bash is a low or high level language (I suspect it is low level due to factors that are in other languages and not in bash)
https://redd.it/1o2le8n
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How do i setup bash LSP in neovim?
I wanted to learn some bash. Then i thought it would be nice to have some auto-completion along the way. I'm on lazy.nvim, so the lsp installation was easy. I think everything works fine, except for i cant autocomplete
https://redd.it/1o3oxue
@r_bash
I wanted to learn some bash. Then i thought it would be nice to have some auto-completion along the way. I'm on lazy.nvim, so the lsp installation was easy. I think everything works fine, except for i cant autocomplete
#!/usr/bin/env bash. Any fix?https://redd.it/1o3oxue
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Am I being inefficient with this copy function I made?
Sometimes I want to copy a file to a directory with a really long path. To save myself having to write out the path for cp, I wrote a copy function that will move the file or directory into a clipboard folder that I created, and a paste function that will move the file or directory from that clipboard directory to my current working directory. So, if I’m in that destination directory with the long path, I can pushd, cd to the file/directory, copy the file, popd, and paste the file. It’s a lot of operations, but they’re all short, and I don’t have to type out that long path. Am I being silly?
https://redd.it/1o4ao2u
@r_bash
Sometimes I want to copy a file to a directory with a really long path. To save myself having to write out the path for cp, I wrote a copy function that will move the file or directory into a clipboard folder that I created, and a paste function that will move the file or directory from that clipboard directory to my current working directory. So, if I’m in that destination directory with the long path, I can pushd, cd to the file/directory, copy the file, popd, and paste the file. It’s a lot of operations, but they’re all short, and I don’t have to type out that long path. Am I being silly?
https://redd.it/1o4ao2u
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
posix arrays
posix_array_write(){ case "$1$2" in *[!0-9a-f\]* ) : ;; * ) eval "memory$1=$2" ;; esac;};
posix_array_read() { case "$1" in *[!0-9a-f\]* ) : ;; * ) eval "printf '%s' \\"\\$memory$1\\"" ;; esac;};
https://redd.it/1o4g8ra
@r_bash
posix_array_write(){ case "$1$2" in *[!0-9a-f\]* ) : ;; * ) eval "memory$1=$2" ;; esac;};
posix_array_read() { case "$1" in *[!0-9a-f\]* ) : ;; * ) eval "printf '%s' \\"\\$memory$1\\"" ;; esac;};
https://redd.it/1o4g8ra
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Struggling to import custom noscript into hummingbot
Whatever I try it does not recognise the file path
https://redd.it/1o4m44u
@r_bash
Whatever I try it does not recognise the file path
https://redd.it/1o4m44u
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Having a lot of trouble with bash/cron
I have been trying for a few days now to do something very specific with my cron job. I want my Python code to be run from a venv every day at noon UTC. My system is not on GMT time, nor do I live there. I also want to code it in such a way that my .sh and .py files will run with pathing that is system agnostic, meaning I want to not have to rewrite all the pathing code every time I move the file. I've done a lot of research and just can't figure out what I'm still doing wrong. I realize this is a very all-over-the-place post, so please feel free to reach out for clarification on any of this.
My questions are as follows:
* Is it possible to pass the timezone variable "Etc/UTC" to crontab without using a .sh file?
* If not, how can I configure my shell file to properly handle variable paths like I would in python with \_\_file\_\_? I was previously just going straight from Python to cron with not a ton of issue with the variable venv paths, but I found that I needed an sh file to do timezones.
* What else am I doing wrong here? Never worked with cron before and honestly I have gone down way too many rabbit holes.
Cron job:
CRON_TZ=Etc/UTC
0 12 * * * bash '/path/to/folder/sotd.sh' >> '/path/to/folder/test.txt' 2>&1
.sh file
#!/usr/bin/env bash
export TZ="Etc/UTC"
source "$PWD/venvlin/bin/activate"
python "$PWD/sotd.py"#!/usr/bin/env bash
Python file:
#!/usr/bin/env python
import os
from pathlib import Path
from dotenv import load_dotenv
pathdir = Path(__file__).parent
filename = Path.joinpath(pathdir.parent, 'test.txt')
with open(filename, "a") as myfile:
myfile.write("\n" + str(pathdir))#!/usr/bin/env python
# rest of code
.
.
.
https://redd.it/1o5z36x
@r_bash
I have been trying for a few days now to do something very specific with my cron job. I want my Python code to be run from a venv every day at noon UTC. My system is not on GMT time, nor do I live there. I also want to code it in such a way that my .sh and .py files will run with pathing that is system agnostic, meaning I want to not have to rewrite all the pathing code every time I move the file. I've done a lot of research and just can't figure out what I'm still doing wrong. I realize this is a very all-over-the-place post, so please feel free to reach out for clarification on any of this.
My questions are as follows:
* Is it possible to pass the timezone variable "Etc/UTC" to crontab without using a .sh file?
* If not, how can I configure my shell file to properly handle variable paths like I would in python with \_\_file\_\_? I was previously just going straight from Python to cron with not a ton of issue with the variable venv paths, but I found that I needed an sh file to do timezones.
* What else am I doing wrong here? Never worked with cron before and honestly I have gone down way too many rabbit holes.
Cron job:
CRON_TZ=Etc/UTC
0 12 * * * bash '/path/to/folder/sotd.sh' >> '/path/to/folder/test.txt' 2>&1
.sh file
#!/usr/bin/env bash
export TZ="Etc/UTC"
source "$PWD/venvlin/bin/activate"
python "$PWD/sotd.py"#!/usr/bin/env bash
Python file:
#!/usr/bin/env python
import os
from pathlib import Path
from dotenv import load_dotenv
pathdir = Path(__file__).parent
filename = Path.joinpath(pathdir.parent, 'test.txt')
with open(filename, "a") as myfile:
myfile.write("\n" + str(pathdir))#!/usr/bin/env python
# rest of code
.
.
.
https://redd.it/1o5z36x
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Does anyone know what this tool is?
I saw a tool that makes any table like command outputs into an actual table (like in sql but more clean, smooth table.).
https://redd.it/1o6b39i
@r_bash
I saw a tool that makes any table like command outputs into an actual table (like in sql but more clean, smooth table.).
https://redd.it/1o6b39i
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How env var inside single quotes
I have a command that looks like
The value of the json-params flag is variable and so I render it into an environment variable:
which renders as
I am unsure how to get that wrapped in single quotes in order to execute mycommand.
I've tried
and a few other things, but the parameter isn't rendering properly in mycommand. How do I get the single quotes around it?
https://redd.it/1o6fvoi
@r_bash
I have a command that looks like
mycommand --json-params '{"key", "value"}'
The value of the json-params flag is variable and so I render it into an environment variable:
JSON_PARAMS='{"key":"'$(getVal)'"}'
which renders as
{"key": "the dynamic value"}
I am unsure how to get that wrapped in single quotes in order to execute mycommand.
I've tried
mycommand --json-params "'"$JSON_PARAMS"'"
mycommand --json-params "\'"$JSON_PARAMS"\'"
mycommand --json-params '$JSON_PARAMS'
mycommand --json-params '\''$JSON_PARAMS'\''
mycommand --json-params \'$JSON_PARAMS\'
and a few other things, but the parameter isn't rendering properly in mycommand. How do I get the single quotes around it?
https://redd.it/1o6fvoi
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Built a Docker-like container using only Bash — no Go, no Docker daemon!
Hey folks,
I’ve been experimenting with how far Bash noscripting can go when it comes to system-level automation — and ended up building a mini container runtime using just Bash commands.
It uses:
• chroot to isolate a root filesystem
• unshare and mount for namespace separation
• veth pairs to wire up basic container networking
• All glued together by Bash functions and noscripts
It’s surprisingly fun to see Linux primitives turn into something Docker-like, and Bash makes it feel super transparent — every line shows what’s happening under the hood.
If you enjoy seeing Bash push its limits, I recorded a short walkthrough of the implementation here →
https://youtu.be/FNfNxoOIZJs
https://redd.it/1o6z9bp
@r_bash
Hey folks,
I’ve been experimenting with how far Bash noscripting can go when it comes to system-level automation — and ended up building a mini container runtime using just Bash commands.
It uses:
• chroot to isolate a root filesystem
• unshare and mount for namespace separation
• veth pairs to wire up basic container networking
• All glued together by Bash functions and noscripts
It’s surprisingly fun to see Linux primitives turn into something Docker-like, and Bash makes it feel super transparent — every line shows what’s happening under the hood.
If you enjoy seeing Bash push its limits, I recorded a short walkthrough of the implementation here →
https://youtu.be/FNfNxoOIZJs
https://redd.it/1o6z9bp
@r_bash
YouTube
I Built a FAST Linux Container in 30 Minutes WITHOUT Docker
Learn how to build a custom Linux container from scratch without using Docker! In this tutorial, I walk you step by step through creating your own container using Linux commands, including advanced features like unshare, network namespaces, veth pairs, and…
What is the cmd for get info of a program? ruby and asciidoctor PDF too...
Hi, I need to know the size, dependencies needed, etc of programs previously to do sudo apt -i (here ruby and asciidoctor-pdf).
What is the cmd to get info about them?
Thank you and Regards!
https://redd.it/1o7pugz
@r_bash
Hi, I need to know the size, dependencies needed, etc of programs previously to do sudo apt -i (here ruby and asciidoctor-pdf).
What is the cmd to get info about them?
Thank you and Regards!
https://redd.it/1o7pugz
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Why this sub shows #!/bin/bash in Google search result page instead of r/xxx
https://preview.redd.it/g347m3cztivf1.png?width=1624&format=png&auto=webp&s=0093e84553d2c9d9610ba46f67a246b4e79a0c8e
https://redd.it/1o8eyvy
@r_bash
https://preview.redd.it/g347m3cztivf1.png?width=1624&format=png&auto=webp&s=0093e84553d2c9d9610ba46f67a246b4e79a0c8e
https://redd.it/1o8eyvy
@r_bash
Learning Bash Scripting
I'm completely lost, I'm trying to find myself a path a road map that could put me on track to learn bash noscripting and hold its power. I'm just a beginner and somehow familiar with the Linux terminal commands. I'll be grateful for an advice.
https://redd.it/1o7zkz8
@r_bash
I'm completely lost, I'm trying to find myself a path a road map that could put me on track to learn bash noscripting and hold its power. I'm just a beginner and somehow familiar with the Linux terminal commands. I'll be grateful for an advice.
https://redd.it/1o7zkz8
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
A prettier ls for your terminal—ls-f, built with Bash and Python
Hey folks 👋
I’ve always loved a clean, colorful terminal — but ls felt… dull.
So I built ls-f — a modern, icon-powered replacement for ls, written entirely in Bash + Python.
🧩 What it does:
1. Adds Nerd Font icons for files and folders
2. Preserves all regular ls flags (-l, -a, -h, etc.)
3. Detects file types automatically
4. Works everywhere — Linux, macOS, Termux — no Rust/Go compilation needed
⚡ Install in one line
curl -fsSL https://raw.githubusercontent.com/swadhinbiswas/ls-f/refs/heads/main/install-standalone.sh | bash
🧠 Why I built it
I wanted a “beautiful
🔗 GitHub: https://github.com/swadhinbiswas/ls-f
⭐ If you like it, please give it a star — it helps others find it!
https://redd.it/1o90b5j
@r_bash
Hey folks 👋
I’ve always loved a clean, colorful terminal — but ls felt… dull.
So I built ls-f — a modern, icon-powered replacement for ls, written entirely in Bash + Python.
🧩 What it does:
1. Adds Nerd Font icons for files and folders
2. Preserves all regular ls flags (-l, -a, -h, etc.)
3. Detects file types automatically
4. Works everywhere — Linux, macOS, Termux — no Rust/Go compilation needed
⚡ Install in one line
curl -fsSL https://raw.githubusercontent.com/swadhinbiswas/ls-f/refs/heads/main/install-standalone.sh | bash
🧠 Why I built it
I wanted a “beautiful
ls” that just worked out of the box without installing huge binaries or dependencies.🔗 GitHub: https://github.com/swadhinbiswas/ls-f
⭐ If you like it, please give it a star — it helps others find it!
https://redd.it/1o90b5j
@r_bash
GitHub
GitHub - swadhinbiswas/ls-f: ls-f is a Linux terminal ls that displays file-type-specific icons using Nerd Fonts. It enhances…
ls-f is a Linux terminal ls that displays file-type-specific icons using Nerd Fonts. It enhances file listings by adding colorful, meaningful icons for different file types . Works on all Linux d...
What Was Your Motivation/Goal for Learning Terminal Usage/Bash/Shell Scripting?
Greetings All !
I'm trying to understand if there is a common subset of motivations for people to dive into terminal usage and shell noscripting.
Of course Curiosity is a strong motivator, BUT what was that killer goal/action/outcome that you couldn't wait to learn enough to accomplish via Terminal Commands / Shell Scripting?
https://redd.it/1o9nz6g
@r_bash
Greetings All !
I'm trying to understand if there is a common subset of motivations for people to dive into terminal usage and shell noscripting.
Of course Curiosity is a strong motivator, BUT what was that killer goal/action/outcome that you couldn't wait to learn enough to accomplish via Terminal Commands / Shell Scripting?
https://redd.it/1o9nz6g
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Interview Question: How would you enter and execute commands on 100s of servers using plain bash noscript?
I thought installing ansible on each node was the only way. But i was required to answer with using bash only. I replied maybe by using SSH-keygen algorithm. Was I correct?
https://redd.it/1o9ppb3
@r_bash
I thought installing ansible on each node was the only way. But i was required to answer with using bash only. I replied maybe by using SSH-keygen algorithm. Was I correct?
https://redd.it/1o9ppb3
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community