fuzpad - A minimalistic note management solution. Powered by fzf.
https://terminaltrove.com/fuzpad/
https://redd.it/1jvxzh1
@r_bash
https://terminaltrove.com/fuzpad/
https://redd.it/1jvxzh1
@r_bash
Terminaltrove
fuzpad - A minimalistic note management solution. Powered by fzf.
A minimalistic note management solution. Powered by fzf. - Discover more CLI and TUI tools like fuzpad and much more on Terminal Trove.
Actual Vim Motions in bash?
I only found like two posts on reddit and another on StackOverFlow where the user is expressing frustration of
The problem though is that there's noticeable latency that I can't wrap my head around, so if someone uses this and it doesn't have latency please tell me what terminal emulator you use.
https://redd.it/1jwrevg
@r_bash
I only found like two posts on reddit and another on StackOverFlow where the user is expressing frustration of
set -o vi and seeking an alternative approach to get vim motions in his shell, which is very shocking to me but maybe I just suck at googling right? or people know their shell keybinings unlike me - lazy to learn something new. Anyway, I found this project which pulls it off: https://github.com/akinomyoga/ble.sh The problem though is that there's noticeable latency that I can't wrap my head around, so if someone uses this and it doesn't have latency please tell me what terminal emulator you use.
https://redd.it/1jwrevg
@r_bash
GitHub
GitHub - akinomyoga/ble.sh: Bash Line Editor―a line editor written in pure Bash with syntax highlighting, auto suggestions, vim…
Bash Line Editor―a line editor written in pure Bash with syntax highlighting, auto suggestions, vim modes, etc. for Bash interactive sessions. - akinomyoga/ble.sh
I need to know why this works.
Why does this function preserve the arg escaping correctly? I sorta get it, and I sorta don't. Is there a better way to do this that works in posix sh like this does?
All the explanations written in the PR are by me, they represent my current understanding, as are the explanations underneath the shellcheck disables.
Is my understanding correct?
Used in this function, which generates C code to stdout
$1 and $2 are a space separated string, of all things passed in to the noscript with --add-flags theval concatenated with spaces
Context
https://github.com/NixOS/nixpkgs/pull/397604
I have tried a ton of ways to do this.
I have tried for arg in "$@"; do for example, but was unable to get that to work.
So why does this work? Can it be improved? This is the only approach I have succeeded with so far.
https://redd.it/1jx8dmm
@r_bash
Why does this function preserve the arg escaping correctly? I sorta get it, and I sorta don't. Is there a better way to do this that works in posix sh like this does?
All the explanations written in the PR are by me, they represent my current understanding, as are the explanations underneath the shellcheck disables.
Is my understanding correct?
arg2list() {
local toset=$1
shift 1
# shellcheck disable=SC2145
# we actually want to eval on structured data.
# so mixing strings with arrays is the point
# shellcheck disable=SC2294
# and yes eval on a string negates the benefits of arrays,
# thats why we leave it an array.
eval "$toset=($@)"
}
Used in this function, which generates C code to stdout
$1 and $2 are a space separated string, of all things passed in to the noscript with --add-flags theval concatenated with spaces
addFlags() {
local n flag before after var
# Disable file globbing, since bash will otherwise try to find
# filenames matching the the value to be prefixed/suffixed if
# it contains characters considered wildcards, such as `?` and
# `*`. We want the value as is, except we also want to split
# it on on the separator; hence we can't quote it.
local reenableGlob=0
if [[ ! -o noglob ]]; then
reenableGlob=1
fi
set -o noglob
# shellcheck disable=SC2086
arg2list before $1
# shellcheck disable=SC2086
arg2list after $2
if (( reenableGlob )); then
set +o noglob
fi
var="argv_tmp"
printf '%s\n' "char **$var = calloc(${#before[@]} + argc + ${#after[@]} + 1, sizeof(*$var));"
printf '%s\n' "assert($var != NULL);"
printf '%s\n' "${var}[0] = argv[0];"
for ((n = 0; n < ${#before[@]}; n += 1)); do
flag=$(escapeStringLiteral "${before[n]}")
printf '%s\n' "${var}[$((n + 1))] = \"$flag\";"
done
printf '%s\n' "for (int i = 1; i < argc; ++i) {"
printf '%s\n' " ${var}[${#before[@]} + i] = argv[i];"
printf '%s\n' "}"
for ((n = 0; n < ${#after[@]}; n += 1)); do
flag=$(escapeStringLiteral "${after[n]}")
printf '%s\n' "${var}[${#before[@]} + argc + $n] = \"$flag\";"
done
printf '%s\n' "${var}[${#before[@]} + argc + ${#after[@]}] = NULL;"
printf '%s\n' "argv = $var;"
}
Context
https://github.com/NixOS/nixpkgs/pull/397604
I have tried a ton of ways to do this.
I have tried for arg in "$@"; do for example, but was unable to get that to work.
So why does this work? Can it be improved? This is the only approach I have succeeded with so far.
https://redd.it/1jx8dmm
@r_bash
GitHub
makeBinaryWrapper: --add-flags arguments now properly escaped by BirdeeHub · Pull Request #397604 · NixOS/nixpkgs
arguments passed to --add-flags were ALWAYS split by spaces regardless of how you passed them. This PR also applies to --append-flags as well
This utilizes normal shell argument parsing to create t...
This utilizes normal shell argument parsing to create t...
Replacing echo with printf broke my noscripts
Taking the advice in https://www.reddit.com/r/bash/comments/1519wby/why\_printf\_over\_echo\_noob\_question/ and elsewhere, I proceeded to do
Whereas echo had worked perfectly, many strings now mysteriously got truncated. I reverted back to echo and all is working well, again, but I'm intrigued why this happened. I tried replacing %s with %b but it made no difference.
Does printf %s not handle utf-8 correctly or something?
https://redd.it/1jxi95b
@r_bash
Taking the advice in https://www.reddit.com/r/bash/comments/1519wby/why\_printf\_over\_echo\_noob\_question/ and elsewhere, I proceeded to do
sed -i 's/echo /printf \x27%s\\n\x27 /' bin/*.shWhereas echo had worked perfectly, many strings now mysteriously got truncated. I reverted back to echo and all is working well, again, but I'm intrigued why this happened. I tried replacing %s with %b but it made no difference.
Does printf %s not handle utf-8 correctly or something?
https://redd.it/1jxi95b
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Why does this work?
Used in this function, which generates C code to stdout
Context
https://github.com/NixOS/nixpkgs/pull/397604
https://redd.it/1jx8bta
@r_bash
arg2list() {
local toset=$1
shift 1
# shellcheck disable=SC2145
# we actually want to eval on structured data.
# so mixing strings with arrays is the point
# shellcheck disable=SC2294
# and yes eval on a string negates the benefits of arrays,
# thats why we leave it an array.
eval "$toset=($@)"
}
Used in this function, which generates C code to stdout
addFlags() {
local n flag before after var
# Disable file globbing, since bash will otherwise try to find
# filenames matching the the value to be prefixed/suffixed if
# it contains characters considered wildcards, such as `?` and
# `*`. We want the value as is, except we also want to split
# it on on the separator; hence we can't quote it.
local reenableGlob=0
if [[ ! -o noglob ]]; then
reenableGlob=1
fi
set -o noglob
# shellcheck disable=SC2086
arg2list before $1
# shellcheck disable=SC2086
arg2list after $2
if (( reenableGlob )); then
set +o noglob
fi
var="argv_tmp"
printf '%s\n' "char **$var = calloc(${#before[@]} + argc + ${#after[@]} + 1, sizeof(*$var));"
printf '%s\n' "assert($var != NULL);"
printf '%s\n' "${var}[0] = argv[0];"
for ((n = 0; n < ${#before[@]}; n += 1)); do
flag=$(escapeStringLiteral "${before[n]}")
printf '%s\n' "${var}[$((n + 1))] = \"$flag\";"
done
printf '%s\n' "for (int i = 1; i < argc; ++i) {"
printf '%s\n' " ${var}[${#before[@]} + i] = argv[i];"
printf '%s\n' "}"
for ((n = 0; n < ${#after[@]}; n += 1)); do
flag=$(escapeStringLiteral "${after[n]}")
printf '%s\n' "${var}[${#before[@]} + argc + $n] = \"$flag\";"
done
printf '%s\n' "${var}[${#before[@]} + argc + ${#after[@]}] = NULL;"
printf '%s\n' "argv = $var;"
}
Context
https://github.com/NixOS/nixpkgs/pull/397604
https://redd.it/1jx8bta
@r_bash
GitHub
makeBinaryWrapper: --add-flags arguments now properly escaped by BirdeeHub · Pull Request #397604 · NixOS/nixpkgs
arguments passed to --add-flags were ALWAYS split by spaces regardless of how you passed them. This PR also applies to --append-flags as well
This utilizes normal shell argument parsing to create t...
This utilizes normal shell argument parsing to create t...
BASHAM! : A Simple Bash Script to Manage Your Assembly Projects.
I've been fooling away my days by doing my hobbies. I was supposed to learn assembly but my idiotic ass learnt bash noscripting instead. At least I can still learn assembly a bit with it...
BASHAM!
Yeah, that's the repo. I'm looking for attention so I get some more contributors... 🫤
https://redd.it/1jynn7o
@r_bash
I've been fooling away my days by doing my hobbies. I was supposed to learn assembly but my idiotic ass learnt bash noscripting instead. At least I can still learn assembly a bit with it...
BASHAM!
Yeah, that's the repo. I'm looking for attention so I get some more contributors... 🫤
https://redd.it/1jynn7o
@r_bash
GitHub
GitHub - lordpaijo/basham: A simple bash noscript to manage your assembly project.
A simple bash noscript to manage your assembly project. - lordpaijo/basham
check if entry is in Array for If Statement
Hi,
New to bash so still trying to understand how to do everything, but in the process of writing a simple backup noscript, now I need to expand it to use an array for the exclusion folder(s) and to get the if statement to ignore any folder in the array.
Can anyone help.
Thanks,
https://redd.it/1jz387b
@r_bash
Hi,
New to bash so still trying to understand how to do everything, but in the process of writing a simple backup noscript, now I need to expand it to use an array for the exclusion folder(s) and to get the if statement to ignore any folder in the array.
Can anyone help.
Thanks,
#!/bin/bash# variablesSOURCE="/volume1/docker/"DEST="/volume1/Backups/Docker-Backups/"DATE=$(date +%Y%m%d_%H%M%S)# EXCLUDE="dir1"EXCLUDE = ("dir1" "dir2" "dir3")#change to folder to backup fromcd $SOURCE# iterate over subdirectoriesfor subdir in */; do#Extract dir namedirname=$(basename "$subdir")# zip dir# need to convert to use arrayif [[ "$dirname" != "$EXCLUDE" ]];thenzip -r "$DEST$dirname $DATE.zip" "$subdir"fidone# delete old backup filesfind $DEST* -mtime +7 -exec rm {} \;https://redd.it/1jz387b
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Do you unit test your Bash noscripts? If so, how?
Curious if anyone here uses a proper testing framework like bats or rolls their own setup? Or do you some
Scripts running in prod always welcome extra paranoia.
https://redd.it/1jzywm5
@r_bash
Curious if anyone here uses a proper testing framework like bats or rolls their own setup? Or do you some
set -euo pipefail, and hope for the best 😅Scripts running in prod always welcome extra paranoia.
https://redd.it/1jzywm5
@r_bash
GitHub
GitHub - bats-core/bats-core: Bash Automated Testing System
Bash Automated Testing System. Contribute to bats-core/bats-core development by creating an account on GitHub.
Is it possible to write a bash noscript that installs python automatically?
I'm developing a YouTube File Manager with python although I need a way for my fellow YouTubers to use it. Unless if there is a way to turn it into an executable version in all operating systems?
https://redd.it/1k0ilyw
@r_bash
I'm developing a YouTube File Manager with python although I need a way for my fellow YouTubers to use it. Unless if there is a way to turn it into an executable version in all operating systems?
https://redd.it/1k0ilyw
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Getting Started with bash
Advice and resources on getting started with bash
:)
https://redd.it/1k0ldhe
@r_bash
Advice and resources on getting started with bash
:)
https://redd.it/1k0ldhe
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Use a custom HISTFILE (to avoid losing history)
https://www.lumeh.org/wiki/linux/bash-configuration/#use-a-custom-histfile
https://redd.it/1k0miqr
@r_bash
https://www.lumeh.org/wiki/linux/bash-configuration/#use-a-custom-histfile
https://redd.it/1k0miqr
@r_bash
www.lumeh.org
Bash Configuration • lumeh.org
What's the most "overkill but it works" bash noscript you've written?
Sometimes I catch myself writing 100-line bash noscripts for things that could probably be done in 5 lines with another tool... but where’s the fun in that?
Curious what ridiculous but functional bash noscripts you've created that made you go: "this is fine."
https://redd.it/1k1c9vg
@r_bash
Sometimes I catch myself writing 100-line bash noscripts for things that could probably be done in 5 lines with another tool... but where’s the fun in that?
Curious what ridiculous but functional bash noscripts you've created that made you go: "this is fine."
https://redd.it/1k1c9vg
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Linux mint cinnamon
I have a school project and they've asked for a few screenshots showing the use of commands to create a tutorial book.
Commands like creating a file, then transferring the file to a different directory.
Everyone I attempt to use the command lines it doesn't work. I've looked up command "cheat sheets" I feel like I'm missing something
https://redd.it/1k1lxu9
@r_bash
I have a school project and they've asked for a few screenshots showing the use of commands to create a tutorial book.
Commands like creating a file, then transferring the file to a different directory.
Everyone I attempt to use the command lines it doesn't work. I've looked up command "cheat sheets" I feel like I'm missing something
https://redd.it/1k1lxu9
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How many REAL MEN are there out there who think sudo is for pussies and just do everything as root?
I can't be the only one.
https://redd.it/1k1tygt
@r_bash
I can't be the only one.
https://redd.it/1k1tygt
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How do you organize large Bash noscripts for better readability and maintenance?
I know “just use Python" but anyway, how do you keep bigger noscripts clean and maintainable? Any tips or examples?
https://redd.it/1k20ou8
@r_bash
I know “just use Python" but anyway, how do you keep bigger noscripts clean and maintainable? Any tips or examples?
https://redd.it/1k20ou8
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How do I list directory contents while looking for FILENAME.EXT with
I don't understand how to properly list (
I'm using this bad, ugly and weird workaround:
Thanks
https://redd.it/1k2afs4
@r_bash
find /directory -type f -name "*.EXT"$ find /directory -type f -name "*.EXT" -exec
I don't understand how to properly list (
ls) the contents of the path itself (the one containing the matched foo.EXT files).I'm using this bad, ugly and weird workaround:
-exec bash -c 'ls -ahl "$(dirname "{}")/"' \;
Thanks
https://redd.it/1k2afs4
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Bugz4Term fire automated commands right for your bug bounty arsenal disposal ( V1.1 )
A Bash tool that fires 4 horizontal terminator panes (2 in each tab) loaded with custom commands from .bugz4term.conf in CWD each line representing a custom command on the config to be loaded ( For terminator users Only! )
Do Checkout bugz4term ( V1.1 ) on Github!
https://github.com/Demgainschill/Bugz4Term
https://redd.it/1k2ylag
@r_bash
A Bash tool that fires 4 horizontal terminator panes (2 in each tab) loaded with custom commands from .bugz4term.conf in CWD each line representing a custom command on the config to be loaded ( For terminator users Only! )
Do Checkout bugz4term ( V1.1 ) on Github!
https://github.com/Demgainschill/Bugz4Term
https://redd.it/1k2ylag
@r_bash
GitHub
GitHub - Demgainschill/Bugz4Term: Fire 4 Horizontal terminator panes (2 in each tab) loaded with custom commands from .bugz4term.conf…
Fire 4 Horizontal terminator panes (2 in each tab) loaded with custom commands from .bugz4term.conf each line representing a custom command on the config to be loaded - Demgainschill/Bugz4Term