Error oh my bash theme development
Good evening everyone, I'm making another theme for Oh My Bash that has the same base as my old theme, but it's not overwriting the base properly, these are the codes
New theme
Base theme
The prompt gets all buggy, it looks like this
https://redd.it/1i6wedj
@r_bash
Good evening everyone, I'm making another theme for Oh My Bash that has the same base as my old theme, but it's not overwriting the base properly, these are the codes
New theme
if [ -z "${NEKONIGHT_BASE_LOADED}" ]; then
source ~/.oh-my-bash/themes/nekonight/nekonight-base.sh
export NEKONIGHT_BASE_LOADED=true
fi
icon_start="╭─"
icon_user=" 🌙 ${_omb_prompt_bold_olive}\u${_omb_prompt_normal}"
icon_host=" at 🌙 ${_omb_prompt_bold_cyan}\h${_omb_prompt_normal}"
icon_directory=" in 🌙 ${_omb_prompt_bold_magenta}\w${_omb_prompt_normal}"
icon_end="╰─${_omb_prompt_bold_white}λ${_omb_prompt_normal}"
_omb_theme_nekonight_git_prompt_info
_omb_theme_nekonight_scm_git_status
function _omb_theme_PROMPT_COMMAND() {
PS1="${icon_start}${icon_user}${icon_host}${icon_directory} in $(_omb_theme_nekonight_git_prompt_info)\n${icon_end} "
}
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND
Base theme
shell
icon_start="╭─"
icon_user=" 🐱 ${_omb_prompt_bold_olive}\u${_omb_prompt_normal}"
icon_host=" at 🐱 ${_omb_prompt_bold_cyan}\h${_omb_prompt_normal}"
icon_directory=" in 🐱 ${_omb_prompt_bold_magenta}\w${_omb_prompt_normal}"
icon_end="╰─${_omb_prompt_bold_white}λ${_omb_prompt_normal}"
function _omb_theme_nekonight_git_prompt_info() {
local branch_name
branch_name=$(git symbolic-ref --short HEAD 2>/dev/null)
local git_status=""
if [[ -n $branch_name ]]; then
git_status="${_omb_prompt_bold_white}(🐱 $branch_name $(_omb_theme_nekonight_scm_git_status))${_omb_prompt_normal}"
fi
echo -n "$git_status"
}
function _omb_theme_nekonight_scm_git_status() {
local git_status=""
if git rev-list --count --left-right @{upstream}...HEAD 2>/dev/null | grep -Eq '^[0-9]+\s[0-9]+$'; then
git_status+="${_omb_prompt_brown}↓${_omb_prompt_normal} "
fi
if [[ -n $(git diff --cached --name-status 2>/dev/null) ]]; then
git_status+="${_omb_prompt_green}+${_omb_prompt_normal}"
fi
if [[ -n $(git diff --name-status 2>/dev/null) ]]; then
git_status+="${_omb_prompt_yellow}•${_omb_prompt_normal}"
fi
if [[ -n $(git ls-files --others --exclude-standard 2>/dev/null) ]]; then
git_status+="${_omb_prompt_red}⌀${_omb_prompt_normal}"
fi
echo -n "$git_status"
}
The prompt gets all buggy, it looks like this
\\\[\\e\[97;1m\\\](🐱 main \\\[\\e\[0;31m\\\]↓\\\[\\e\[0m\\\] \\\[\\e\[0;93m\\\]•\\\[\\e\[0m\\\]\\\[\\e\[0;91m\\\]⌀\\\[\\e\[0m\\\])\\\[\\e\[0m\\\]\\\[\\e\[0;31m\\\]↓\\\[\\e\[0m\\\] \\\[\\e\[0;93m\\\]•\\\[\\e\[0m\\\]\\\[\\e\[0m\\\]╭─ 🌙 brunociccarino at 🌙 DESKTOP-27DNBRN in 🌙 \~ in (🐱 main ↓ •⌀)
╰─λ
https://redd.it/1i6wedj
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
style enforcement tool?
Hi folks, looking for a sh and bash enforcement tool. I found bashate but seems too limited.
https://redd.it/1i5yexv
@r_bash
Hi folks, looking for a sh and bash enforcement tool. I found bashate but seems too limited.
https://redd.it/1i5yexv
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Sed replacement with a variable needs single and double quotes
Hi all, this may be a stupid question, so sorry in advance. I have just started to get into the world of bash noscripting, and I decided to create an install noscript for my NixOS build. Within that, I want to create a new host, so I have decided to use
From what I could find when googling this, I need to exit the single quotes with double quotes when writing the expression, then go back to singles to finish it.
https://askubuntu.com/questions/1390037/using-sed-with-a-variable-inside-double-quote
So this is what i have so far
https://redd.it/1i8te4k
@r_bash
Hi all, this may be a stupid question, so sorry in advance. I have just started to get into the world of bash noscripting, and I decided to create an install noscript for my NixOS build. Within that, I want to create a new host, so I have decided to use
sed to add a block of Nix code from a text file in place of a comment that I have there by default. The problem arises then that I need to evaluate bash noscript within it using double quotes "" as well as using the s option at the start, which from what I can see only works with single quotes ''. From what I could find when googling this, I need to exit the single quotes with double quotes when writing the expression, then go back to singles to finish it.
https://askubuntu.com/questions/1390037/using-sed-with-a-variable-inside-double-quote
So this is what i have so far
sudo sed -i 's|#Install new host hook|'"$(< /etc/nixos/noscripts/helperFiles/newHostFlakeBlock.txt)"'|' /etc/nixos/flake.nixhttps://redd.it/1i8te4k
@r_bash
Ask Ubuntu
Using sed with a variable inside double quote
I have a file input.xml which contains a line: <exciton lambda="1" fix="hole"/>
in that line I want to replace 1 with 2 but I can't use just 1 as key word since there are ...
in that line I want to replace 1 with 2 but I can't use just 1 as key word since there are ...
Creating a simple latex launcher
Hello!
I'm not sure I'm posting in the good subreddit, don't hesitate to redirect me!
I've a little problem I'm not able to solve, because I don't understand well enough the problem to know where to search.
I would like to create a noscript that manages a .tex file such as :
- it opens a terminal and launches
- it opens the file with kwrite
Ideally, I declare this noscript as an application that I can set as the default application for
I first tried to create a
Then I added a
Thanks in advance for your help!
https://redd.it/1i8aa47
@r_bash
Hello!
I'm not sure I'm posting in the good subreddit, don't hesitate to redirect me!
I've a little problem I'm not able to solve, because I don't understand well enough the problem to know where to search.
I would like to create a noscript that manages a .tex file such as :
- it opens a terminal and launches
latex -pdf -pvc $FILE, $FILE being the argument file- it opens the file with kwrite
Ideally, I declare this noscript as an application that I can set as the default application for
.tex files. This way, when I double click on the file every of these actions execute themselves.I first tried to create a
latex.sh noscript (yes it's executable) :#!/bin/bash
latexmk -pdf -pvc $1 &
kwrite $1 &
Then I added a
.desktop file in ~/.local/share/applications and tried to open a .tex file with this application. Without surprise it does not work, but I don't really know what exactly is the process I want to see in the system so it's difficult to improve the noscript...Thanks in advance for your help!
https://redd.it/1i8aa47
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Importance of checking IFS
I just wanted to spread a word about importance of explicitly defining and assigning values to IFS.
After years of noscripting in bash in Ubuntu i never thought of non standard IFS values in other linux based operating systems.
Few minutes ago figured out why some of my noscripts weren’t working properly in openwrt. IFS in openwrt contains only /n newline character vs tab space and newline.
Can be checked by looking into environment via set (printenv is not installed by default) or simply by echoing IFS and piping into cat: echo “$IFS” | cat -A
Hope this will save someone down the road from wasting hours on debugging.
My noscripts weren’t working simply copied to openwrt as they were working on Ubuntu and didnt show any issues at first glance. I want to pinpoint here that i didnt write in openwrt environment or else i would have checked IFS. From now on i will make a habit to assign it right after the shebang.
Thanks.
https://redd.it/1i9qz8r
@r_bash
I just wanted to spread a word about importance of explicitly defining and assigning values to IFS.
After years of noscripting in bash in Ubuntu i never thought of non standard IFS values in other linux based operating systems.
Few minutes ago figured out why some of my noscripts weren’t working properly in openwrt. IFS in openwrt contains only /n newline character vs tab space and newline.
Can be checked by looking into environment via set (printenv is not installed by default) or simply by echoing IFS and piping into cat: echo “$IFS” | cat -A
Hope this will save someone down the road from wasting hours on debugging.
My noscripts weren’t working simply copied to openwrt as they were working on Ubuntu and didnt show any issues at first glance. I want to pinpoint here that i didnt write in openwrt environment or else i would have checked IFS. From now on i will make a habit to assign it right after the shebang.
Thanks.
https://redd.it/1i9qz8r
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
HELP!
I'm trying to make a simple OS that uses BASH and coreutils as a base.
I searched and asked to chatgpt how to compile it to a unknown os and basically everything went wrong.
btw, i'm on windows 11 with nasm,gcc, mingw, msys2 and Arch WSL.
Can someone help me?
https://redd.it/1i9qukp
@r_bash
I'm trying to make a simple OS that uses BASH and coreutils as a base.
I searched and asked to chatgpt how to compile it to a unknown os and basically everything went wrong.
btw, i'm on windows 11 with nasm,gcc, mingw, msys2 and Arch WSL.
Can someone help me?
https://redd.it/1i9qukp
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Chatgpt in bash
Hi, first post here so please go easy..... !
I love modifying bash, and have recently thought about having Chatgpt work directly from bash by just typing a simple command whenever needed/wanted. As a result i have created the following, it seems to work fine and have added a menu to it for added functionality.
Feedback would be most welcome please - https://github.com/Fenlanddavid/AI-command/blob/main/gpt.sh
https://redd.it/1ial3l3
@r_bash
Hi, first post here so please go easy..... !
I love modifying bash, and have recently thought about having Chatgpt work directly from bash by just typing a simple command whenever needed/wanted. As a result i have created the following, it seems to work fine and have added a menu to it for added functionality.
Feedback would be most welcome please - https://github.com/Fenlanddavid/AI-command/blob/main/gpt.sh
https://redd.it/1ial3l3
@r_bash
GitHub
AI-command/gpt.sh at main · Fenlanddavid/AI-command
Small command-line AI assistant tool for quick interactions with GPT. - Fenlanddavid/AI-command
Simple noscript to integrate chat-gpt into bash
Will try this post again now...
I love messing around and modifying bash, my latest project has been to integrate chat-gpt into the command line. wanted to just type a normal command and have it reply whenever i needed/wanted it too. It became a little more complicated as i went on and had to add various functions such as save session memory for it to be effective-also added a simple menu. Works ok on my system but just after a little feedback please **you will need your own openai API key**
https://github.com/Fenlanddavid/arch-ai
Ps- did attach image but does not seem to be displaying.....
https://redd.it/1iap1xd
@r_bash
Will try this post again now...
I love messing around and modifying bash, my latest project has been to integrate chat-gpt into the command line. wanted to just type a normal command and have it reply whenever i needed/wanted it too. It became a little more complicated as i went on and had to add various functions such as save session memory for it to be effective-also added a simple menu. Works ok on my system but just after a little feedback please **you will need your own openai API key**
https://github.com/Fenlanddavid/arch-ai
Ps- did attach image but does not seem to be displaying.....
https://redd.it/1iap1xd
@r_bash
GitHub
GitHub - Fenlanddavid/arch-ai: A small command-line AI assistant tool for quick interactions with GPT.
A small command-line AI assistant tool for quick interactions with GPT. - Fenlanddavid/arch-ai
Shunpo: A Bash Tool for Quick Directory Navigation
Hi fellow redditors. I recently wrote a minimalistic navigation tool for bash. A few of my colleagues liked it, so I thought I'd make the repository public and share it. Here's a video demo-ing it . I hope it helps speed up your navigation!
Link to the repo:
https://github.com/egurapha/Shunpo
Link to a youtube video:
https://www.youtube.com/watch?v=TN66A3MPo50
https://i.redd.it/o2t12nrceefe1.gif
https://redd.it/1iap8nv
@r_bash
Hi fellow redditors. I recently wrote a minimalistic navigation tool for bash. A few of my colleagues liked it, so I thought I'd make the repository public and share it. Here's a video demo-ing it . I hope it helps speed up your navigation!
Link to the repo:
https://github.com/egurapha/Shunpo
Link to a youtube video:
https://www.youtube.com/watch?v=TN66A3MPo50
https://i.redd.it/o2t12nrceefe1.gif
https://redd.it/1iap8nv
@r_bash
GitHub
GitHub - egurapha/Shunpo: A minimalist bash tool that makes directory navigation just a little bit faster.
A minimalist bash tool that makes directory navigation just a little bit faster. - egurapha/Shunpo
YAML manipulating with basic tools, without yq
The problem. I have a YAML file with this:
network:
version: 2
renderer: networkd
ethernets:
wifis:
wlx44334c47dec3:
dhcp4: true
dhcp6: true
As you can see, there is an empty section ethernets, but we could also have wifis section empty. This is invalid structure and I need to remove those empty sections:
This result:
network:
version: 2
renderer: networkd
wifis:
wlx44334c47dec3:
dhcp4: true
dhcp6: true
can be achieved easily with:
yq -y 'del(.network.ethernets | select(length == 0)) | del(.network.wifis | select(length == 0))'
But I want to achieve the same with sed / awk / regex. Any idea how?
https://redd.it/1ib15ky
@r_bash
The problem. I have a YAML file with this:
network:
version: 2
renderer: networkd
ethernets:
wifis:
wlx44334c47dec3:
dhcp4: true
dhcp6: true
As you can see, there is an empty section ethernets, but we could also have wifis section empty. This is invalid structure and I need to remove those empty sections:
This result:
network:
version: 2
renderer: networkd
wifis:
wlx44334c47dec3:
dhcp4: true
dhcp6: true
can be achieved easily with:
yq -y 'del(.network.ethernets | select(length == 0)) | del(.network.wifis | select(length == 0))'
But I want to achieve the same with sed / awk / regex. Any idea how?
https://redd.it/1ib15ky
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
want to print only the real time
real 0m0.004s
user 0m0.001s
sys 0m0.003s
but i only want to print the first line
is there any way ?```
https://redd.it/1ib76ah
@r_bash
time ./progreal 0m0.004s
user 0m0.001s
sys 0m0.003s
but i only want to print the first line
real 0m0.004s or 0m0.004sis there any way ?```
https://redd.it/1ib76ah
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
convert nested css to standard syntax css
Hi im new in this sub and i don't have much experience with bash in general, i was trying to create a noscript that allows me to convert nested css that has multi-selector in to standard css, currently i got my noscript working for nested css, but it seem i can't find a way to eleaborate multi selector (es. #foo, .bar).
Also tryed to ask gpt but it just added some comments and made me feel more miserable.
Can someone give me a hand?
#!/bin/bash
# Ensure the noscript receives correct arguments
if [ "$#" -ne 2 ]; then
echo "Usage: $0 input_file output_file"
exit 1
fi
input_file=$1
output_file=$2
# Check if the input file exists and is readable
if [ ! -f "$input_file" ]; then
echo "Error: Input file '$input_file' does not exist or is not a file."
exit 1
fi
# Create or clear the output file
>"$output_file"
# Initialize variables
current_selector=""
current_styles=""
parent_selector_stack=()
multi_selector_members=()
is_multi_selector=false
media_query=false
# Function to flush a selector and its styles
flush_selector() {
trimmed_current_styles=$(echo "$current_styles" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
trimmed_current_selector=$(echo "$current_selector" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
check_style=$(echo "$current_styles" | tr -d '[:space:]\\n')
# Only flush if the selector and styles are not empty
if [ -n "$trimmed_current_selector" ] && [ -n "$check_style" ]; then
{
echo "$trimmed_current_selector {"
echo -e "$trimmed_current_styles"
echo "}"
} >>"$output_file"
fi
current_styles=""
}
# Handle multi-selectors (combine selectors with commas and ensure proper space)
handle_multi_selectors_with_children() {
local base_selectors=("$@")
local child_selector="$current_selector"
local combined_selectors=""
# Loop through each base selector and append the child selector
for base_selector in "${base_selectors[@]}"; do
if [ -n "$child_selector" ]; then
combined_selectors+="$base_selector $child_selector, "
else
combined_selectors+="$base_selector, "
fi
done
# Remove trailing comma and space
combined_selectors=$(echo "$combined_selectors" | sed 's/, $//')
echo "$combined_selectors"
}
# Read the input file line by line
while IFS= read -r line || [ -n "$line" ]; do
# Remove leading and trailing whitespace
line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
if [[ "$line" =~ ^@media ]]; then
# If it's a media query, start a new media query block
flush_selector
media_query=true
current_selector=$(echo "$line" | sed 's/{//g')
parent_selector_stack=("$current_selector")
continue
elif [[ "$line" =~ ^[.#\[][^,{]*\{$ ]]; then
# Handle new selector block or nested multi-selector
if [ "$is_multi_selector" = true ]; then
# If multi-selector handling was active, expand them with the current child selector
expanded_selectors=$(handle_multi_selectors_with_children "${multi_selector_members[@]}")
current_selector="$expanded_selectors"
flush_selector
multi_selector_members=() # Clear the multi-selector list
is_multi_selector=false
fi
# Flush the previous selector before processing the new one
flush_selector
# Extract the current selector and add it to the multi-selector array if needed
new_selector=$(echo "$line" | sed 's/{//g' | tr -d '\n')
if [ "$is_multi_selector" = true ]; then
Hi im new in this sub and i don't have much experience with bash in general, i was trying to create a noscript that allows me to convert nested css that has multi-selector in to standard css, currently i got my noscript working for nested css, but it seem i can't find a way to eleaborate multi selector (es. #foo, .bar).
Also tryed to ask gpt but it just added some comments and made me feel more miserable.
Can someone give me a hand?
#!/bin/bash
# Ensure the noscript receives correct arguments
if [ "$#" -ne 2 ]; then
echo "Usage: $0 input_file output_file"
exit 1
fi
input_file=$1
output_file=$2
# Check if the input file exists and is readable
if [ ! -f "$input_file" ]; then
echo "Error: Input file '$input_file' does not exist or is not a file."
exit 1
fi
# Create or clear the output file
>"$output_file"
# Initialize variables
current_selector=""
current_styles=""
parent_selector_stack=()
multi_selector_members=()
is_multi_selector=false
media_query=false
# Function to flush a selector and its styles
flush_selector() {
trimmed_current_styles=$(echo "$current_styles" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
trimmed_current_selector=$(echo "$current_selector" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
check_style=$(echo "$current_styles" | tr -d '[:space:]\\n')
# Only flush if the selector and styles are not empty
if [ -n "$trimmed_current_selector" ] && [ -n "$check_style" ]; then
{
echo "$trimmed_current_selector {"
echo -e "$trimmed_current_styles"
echo "}"
} >>"$output_file"
fi
current_styles=""
}
# Handle multi-selectors (combine selectors with commas and ensure proper space)
handle_multi_selectors_with_children() {
local base_selectors=("$@")
local child_selector="$current_selector"
local combined_selectors=""
# Loop through each base selector and append the child selector
for base_selector in "${base_selectors[@]}"; do
if [ -n "$child_selector" ]; then
combined_selectors+="$base_selector $child_selector, "
else
combined_selectors+="$base_selector, "
fi
done
# Remove trailing comma and space
combined_selectors=$(echo "$combined_selectors" | sed 's/, $//')
echo "$combined_selectors"
}
# Read the input file line by line
while IFS= read -r line || [ -n "$line" ]; do
# Remove leading and trailing whitespace
line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
if [[ "$line" =~ ^@media ]]; then
# If it's a media query, start a new media query block
flush_selector
media_query=true
current_selector=$(echo "$line" | sed 's/{//g')
parent_selector_stack=("$current_selector")
continue
elif [[ "$line" =~ ^[.#\[][^,{]*\{$ ]]; then
# Handle new selector block or nested multi-selector
if [ "$is_multi_selector" = true ]; then
# If multi-selector handling was active, expand them with the current child selector
expanded_selectors=$(handle_multi_selectors_with_children "${multi_selector_members[@]}")
current_selector="$expanded_selectors"
flush_selector
multi_selector_members=() # Clear the multi-selector list
is_multi_selector=false
fi
# Flush the previous selector before processing the new one
flush_selector
# Extract the current selector and add it to the multi-selector array if needed
new_selector=$(echo "$line" | sed 's/{//g' | tr -d '\n')
if [ "$is_multi_selector" = true ]; then
multi_selector_members+=("$new_selector")
parent_selector_stack+=("&referencetomultiselect&")
else
# If there's a current selector, combine it with the new selector
if [ -n "$current_selector" ]; then
current_selector="$current_selector $new_selector"
else
current_selector="$new_selector"
fi
parent_selector_stack+=("$current_selector")
fi
elif [[ "$line" =~ ^[.#\[][^,{]*,$ ]]; then
# Handle multi-selectors (those ending with a comma)
is_multi_selector=true
new_selector=$(echo "$line" | sed 's/,//g' | tr -d '\n')
multi_selector_members+=("$new_selector")
elif [[ "$line" =~ ^\}$ ]]; then
# End of the current block
flush_selector
# Handle multi-selector members if they exist
if [ "$is_multi_selector" = true ]; then
expanded_selectors=$(handle_multi_selectors_with_children "${multi_selector_members[@]}")
current_selector="$expanded_selectors"
flush_selector
multi_selector_members=() # Clear the multi-selector list
is_multi_selector=false
fi
# Reset media query flag if we're closing a media query
if [ "$media_query" = true ]; then
media_query=false
fi
# Loop through parent_selector_stack and find references to multi-selector
final_selectors=()
for selector in "${parent_selector_stack[@]}"; do
if [[ "$selector" == "&referencetomultiselect&" ]]; then
# Replace reference with expanded multi-selectors
final_selectors+=($(handle_multi_selectors_with_children "${multi_selector_members[@]}"))
else
final_selectors+=("$selector")
fi
done
# Add the final selectors back to the parent stack
parent_selector_stack=("${final_selectors[@]}")
# Pop the last selector from the stack (we're closing the current block)
if [ ${#parent_selector_stack[@]} -gt 0 ]; then
unset 'parent_selector_stack[-1]'
fi
# Reset the current selector to the top of the stack
if [ ${#parent_selector_stack[@]} -gt 0 ]; then
current_selector="${parent_selector_stack[-1]}"
else
current_selector=""
fi
else
# Treat the line as a style and append it
current_styles="$current_styles\n $line"
fi
done <"$input_file"
# Flush any remaining selectors
flush_selector
echo "CSS processing complete. Output written to $output_file"
https://redd.it/1ic6azt
@r_bash
parent_selector_stack+=("&referencetomultiselect&")
else
# If there's a current selector, combine it with the new selector
if [ -n "$current_selector" ]; then
current_selector="$current_selector $new_selector"
else
current_selector="$new_selector"
fi
parent_selector_stack+=("$current_selector")
fi
elif [[ "$line" =~ ^[.#\[][^,{]*,$ ]]; then
# Handle multi-selectors (those ending with a comma)
is_multi_selector=true
new_selector=$(echo "$line" | sed 's/,//g' | tr -d '\n')
multi_selector_members+=("$new_selector")
elif [[ "$line" =~ ^\}$ ]]; then
# End of the current block
flush_selector
# Handle multi-selector members if they exist
if [ "$is_multi_selector" = true ]; then
expanded_selectors=$(handle_multi_selectors_with_children "${multi_selector_members[@]}")
current_selector="$expanded_selectors"
flush_selector
multi_selector_members=() # Clear the multi-selector list
is_multi_selector=false
fi
# Reset media query flag if we're closing a media query
if [ "$media_query" = true ]; then
media_query=false
fi
# Loop through parent_selector_stack and find references to multi-selector
final_selectors=()
for selector in "${parent_selector_stack[@]}"; do
if [[ "$selector" == "&referencetomultiselect&" ]]; then
# Replace reference with expanded multi-selectors
final_selectors+=($(handle_multi_selectors_with_children "${multi_selector_members[@]}"))
else
final_selectors+=("$selector")
fi
done
# Add the final selectors back to the parent stack
parent_selector_stack=("${final_selectors[@]}")
# Pop the last selector from the stack (we're closing the current block)
if [ ${#parent_selector_stack[@]} -gt 0 ]; then
unset 'parent_selector_stack[-1]'
fi
# Reset the current selector to the top of the stack
if [ ${#parent_selector_stack[@]} -gt 0 ]; then
current_selector="${parent_selector_stack[-1]}"
else
current_selector=""
fi
else
# Treat the line as a style and append it
current_styles="$current_styles\n $line"
fi
done <"$input_file"
# Flush any remaining selectors
flush_selector
echo "CSS processing complete. Output written to $output_file"
https://redd.it/1ic6azt
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Get stderr and stdout separated?
How would I populate e with the stderr stream?
I need to "return" it with the function, hence I cannot use a function substitution forward of 2> >()
I just want to avoid writing to a temp file for this.
https://redd.it/1iclsku
@r_bash
How would I populate e with the stderr stream?
r="0"; e=""; m="$(eval "$logic")" || r="1" && returnCode="1"I need to "return" it with the function, hence I cannot use a function substitution forward of 2> >()
I just want to avoid writing to a temp file for this.
https://redd.it/1iclsku
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Why is "set -e" not the default or not left in noscripts after creation?
"set -e" as most of you know will exit a noscript on error. It (and other set commands) is often used in a noscript during development when errors are expected and you want immediate halt.
But why is this behavior not the default anyway? Surely in vast majority of cases when a noscript is in production and there is an error, you would want the noscript to halt rather than attempt to execute the rest of it (much of which will have dependency and less likely to just be an independent process)?
https://redd.it/1icwuqh
@r_bash
"set -e" as most of you know will exit a noscript on error. It (and other set commands) is often used in a noscript during development when errors are expected and you want immediate halt.
But why is this behavior not the default anyway? Surely in vast majority of cases when a noscript is in production and there is an error, you would want the noscript to halt rather than attempt to execute the rest of it (much of which will have dependency and less likely to just be an independent process)?
https://redd.it/1icwuqh
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Does anyone have any good recommendations for learning awk? I've tried a few books and YT videos but I'm finding my eyes glazing over. I worked with LLMs to make it do some advanced editing and I'm super excited to learn how to actually drive it myself, but I haven't found anything that gels with me
https://redd.it/1id47fq
@r_bash
https://redd.it/1id47fq
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Help me improve my MySQL backup noscript
So I've got a working backup noscript for backing up MySQL databases on different database servers. The noscript is run every hour via cron job on an Apache server and subseqently backed up via FTP to a local NAS. I know it's not pretty, but as long as it works...
'''
#!/bin/bash
backupdir=/backup
timestamp=$(date +%Y-%m-%dT%H:%M)
user=dbuser
backupretentiontime=10
mkdir -p "$backupdir/$timestamp"
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database1 | gzip -9 > ${backupdir}/$timestamp/database1-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver2.com' database2 | gzip -9 > ${backupdir}/$timestamp/database2-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database3 | gzip -9 > ${backupdir}/$timestamp/database3-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver3.com' database4 | gzip -9 > ${backupdir}/$timestamp/database4-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database5 | gzip -9 > ${backupdir}/$timestamp/database5-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database6 | gzip -9 > ${backupdir}/$timestamp/database6-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database7 | gzip -9 > ${backupdir}/$timestamp/database7-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database8 | gzip -9 > ${backupdir}/$timestamp/database8-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database9 | gzip -9 > ${backupdir}/$timestamp/database9-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database10 | gzip -9 > ${backupdir}/$timestamp/database10-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database11 | gzip -9 > ${backupdir}/$timestamp/database11-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database12 | gzip -9 > ${backupdir}/$timestamp/database12-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database13 | gzip -9 > ${backupdir}/$timestamp/database13-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database14 | gzip -9 > ${backupdir}/$timestamp/database14-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database15 | gzip -9 > ${backupdir}/$timestamp/database15-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver4.com' database16 | gzip -9 > ${backupdir}/$timestamp/database16-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database17 | gzip -9 > ${backupdir}/$timestamp/database17-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database18 | gzip -9 > ${backupdir}/$timestamp/database18-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database19 | gzip -9 > ${backupdir}/$timestamp/database19-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver2.com' database20 | gzip -9 >
So I've got a working backup noscript for backing up MySQL databases on different database servers. The noscript is run every hour via cron job on an Apache server and subseqently backed up via FTP to a local NAS. I know it's not pretty, but as long as it works...
'''
#!/bin/bash
backupdir=/backup
timestamp=$(date +%Y-%m-%dT%H:%M)
user=dbuser
backupretentiontime=10
mkdir -p "$backupdir/$timestamp"
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database1 | gzip -9 > ${backupdir}/$timestamp/database1-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver2.com' database2 | gzip -9 > ${backupdir}/$timestamp/database2-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database3 | gzip -9 > ${backupdir}/$timestamp/database3-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver3.com' database4 | gzip -9 > ${backupdir}/$timestamp/database4-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database5 | gzip -9 > ${backupdir}/$timestamp/database5-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database6 | gzip -9 > ${backupdir}/$timestamp/database6-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database7 | gzip -9 > ${backupdir}/$timestamp/database7-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database8 | gzip -9 > ${backupdir}/$timestamp/database8-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database9 | gzip -9 > ${backupdir}/$timestamp/database9-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database10 | gzip -9 > ${backupdir}/$timestamp/database10-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database11 | gzip -9 > ${backupdir}/$timestamp/database11-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database12 | gzip -9 > ${backupdir}/$timestamp/database12-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database13 | gzip -9 > ${backupdir}/$timestamp/database13-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database14 | gzip -9 > ${backupdir}/$timestamp/database14-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database15 | gzip -9 > ${backupdir}/$timestamp/database15-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver4.com' database16 | gzip -9 > ${backupdir}/$timestamp/database16-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database17 | gzip -9 > ${backupdir}/$timestamp/database17-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database18 | gzip -9 > ${backupdir}/$timestamp/database18-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database19 | gzip -9 > ${backupdir}/$timestamp/database19-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver2.com' database20 | gzip -9 >
Help me improve my MySQL backup noscript
So I've got a working backup noscript for backing up MySQL databases on different database servers. The noscript is run every hour via cron job on an Apache server and subseqently backed up via FTP to a local NAS. I know it's not pretty, but as long as it works...
'''
#!/bin/bash
backup_dir=/backup
timestamp=$(date +%Y-%m-%dT%H:%M)
user=dbuser
backup_retention_time=10
mkdir -p "$backup_dir/$timestamp"
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_1 | gzip -9 > ${backup_dir}/$timestamp/database_1-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver2.com' database_2 | gzip -9 > ${backup_dir}/$timestamp/database_2-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_3 | gzip -9 > ${backup_dir}/$timestamp/database_3-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver3.com' database_4 | gzip -9 > ${backup_dir}/$timestamp/database_4-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_5 | gzip -9 > ${backup_dir}/$timestamp/database_5-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_6 | gzip -9 > ${backup_dir}/$timestamp/database_6-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_7 | gzip -9 > ${backup_dir}/$timestamp/database_7-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_8 | gzip -9 > ${backup_dir}/$timestamp/database_8-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_9 | gzip -9 > ${backup_dir}/$timestamp/database_9-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_10 | gzip -9 > ${backup_dir}/$timestamp/database_10-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_11 | gzip -9 > ${backup_dir}/$timestamp/database_11-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_12 | gzip -9 > ${backup_dir}/$timestamp/database_12-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_13 | gzip -9 > ${backup_dir}/$timestamp/database_13-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_14 | gzip -9 > ${backup_dir}/$timestamp/database_14-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_15 | gzip -9 > ${backup_dir}/$timestamp/database_15-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver4.com' database_16 | gzip -9 > ${backup_dir}/$timestamp/database_16-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_17 | gzip -9 > ${backup_dir}/$timestamp/database_17-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_18 | gzip -9 > ${backup_dir}/$timestamp/database_18-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_19 | gzip -9 > ${backup_dir}/$timestamp/database_19-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver2.com' database_20 | gzip -9 >
So I've got a working backup noscript for backing up MySQL databases on different database servers. The noscript is run every hour via cron job on an Apache server and subseqently backed up via FTP to a local NAS. I know it's not pretty, but as long as it works...
'''
#!/bin/bash
backup_dir=/backup
timestamp=$(date +%Y-%m-%dT%H:%M)
user=dbuser
backup_retention_time=10
mkdir -p "$backup_dir/$timestamp"
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_1 | gzip -9 > ${backup_dir}/$timestamp/database_1-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver2.com' database_2 | gzip -9 > ${backup_dir}/$timestamp/database_2-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_3 | gzip -9 > ${backup_dir}/$timestamp/database_3-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver3.com' database_4 | gzip -9 > ${backup_dir}/$timestamp/database_4-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_5 | gzip -9 > ${backup_dir}/$timestamp/database_5-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_6 | gzip -9 > ${backup_dir}/$timestamp/database_6-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_7 | gzip -9 > ${backup_dir}/$timestamp/database_7-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_8 | gzip -9 > ${backup_dir}/$timestamp/database_8-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_9 | gzip -9 > ${backup_dir}/$timestamp/database_9-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_10 | gzip -9 > ${backup_dir}/$timestamp/database_10-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_11 | gzip -9 > ${backup_dir}/$timestamp/database_11-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_12 | gzip -9 > ${backup_dir}/$timestamp/database_12-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_13 | gzip -9 > ${backup_dir}/$timestamp/database_13-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_14 | gzip -9 > ${backup_dir}/$timestamp/database_14-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_15 | gzip -9 > ${backup_dir}/$timestamp/database_15-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver4.com' database_16 | gzip -9 > ${backup_dir}/$timestamp/database_16-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_17 | gzip -9 > ${backup_dir}/$timestamp/database_17-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_18 | gzip -9 > ${backup_dir}/$timestamp/database_18-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_19 | gzip -9 > ${backup_dir}/$timestamp/database_19-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver2.com' database_20 | gzip -9 >
${backup_dir}/$timestamp/database_20-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_21 | gzip -9 > ${backup_dir}/$timestamp/database_21-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_22 | gzip -9 > ${backup_dir}/$timestamp/database_22-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_23 | gzip -9 > ${backup_dir}/$timestamp/database_23-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_24 | gzip -9 > ${backup_dir}/$timestamp/database_24-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_25 | gzip -9 > ${backup_dir}/$timestamp/database_25-$timestamp.sql.gz
find $backup_dir -depth -type d -mtime +$backup_retention_time -exec rm -r {} \;
'''
My main goal is to implement a rolling backup/retention strategy, i.e. I want to keep
* 24 hourly backups
* 7 daily backups
* 12 monthly backups
Any help is greatly appreciated!
EDIT: changed the timestamp from %Y-%m-%dT%H:%M to %Y-%m-%dT%H-%M for better compatibility.
https://redd.it/1icu3vc
@r_bash
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_21 | gzip -9 > ${backup_dir}/$timestamp/database_21-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_22 | gzip -9 > ${backup_dir}/$timestamp/database_22-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_23 | gzip -9 > ${backup_dir}/$timestamp/database_23-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_24 | gzip -9 > ${backup_dir}/$timestamp/database_24-$timestamp.sql.gz
mysqldump --defaults-file=/files/.my.cnf --opt --no-tablespaces --user=$user --host='dbserver1.com' database_25 | gzip -9 > ${backup_dir}/$timestamp/database_25-$timestamp.sql.gz
find $backup_dir -depth -type d -mtime +$backup_retention_time -exec rm -r {} \;
'''
My main goal is to implement a rolling backup/retention strategy, i.e. I want to keep
* 24 hourly backups
* 7 daily backups
* 12 monthly backups
Any help is greatly appreciated!
EDIT: changed the timestamp from %Y-%m-%dT%H:%M to %Y-%m-%dT%H-%M for better compatibility.
https://redd.it/1icu3vc
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How to configure terminal to show the entire previous command, without truncating it with an ellipsis?
Using iterm2 on MacOS with ZSH and powerlevel10k and Oh-My-Zsh. Nothing unusual.
When I paste a long `curl` command (with a request body that has a few dozen lines or more) into the terminal and execute it, I want to see the entire command when I press the Up arrow key to reload the last command from my history.
But what actually happens is only the last 30 or so lines of the command are shown when I press the Up arrow key, truncating all the lines above with an ellipsis (...).
I want to configure my terminal to actually display the *whole* entire command when I press Up.
I assume this is a config issue somewhere either in my `\~/.zshrc` file or the `\~/.p10k.zsh` file, but have no clue if that's correct.
https://redd.it/1ic5jhd
@r_bash
Using iterm2 on MacOS with ZSH and powerlevel10k and Oh-My-Zsh. Nothing unusual.
When I paste a long `curl` command (with a request body that has a few dozen lines or more) into the terminal and execute it, I want to see the entire command when I press the Up arrow key to reload the last command from my history.
But what actually happens is only the last 30 or so lines of the command are shown when I press the Up arrow key, truncating all the lines above with an ellipsis (...).
I want to configure my terminal to actually display the *whole* entire command when I press Up.
I assume this is a config issue somewhere either in my `\~/.zshrc` file or the `\~/.p10k.zsh` file, but have no clue if that's correct.
https://redd.it/1ic5jhd
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community