Help optimizing my bash noscript for cycling video/static wallpapers with mpvpaper and swww
https://codefile.io/f/ybOplh8ij6
https://redd.it/1mre3iy
@r_bash
https://codefile.io/f/ybOplh8ij6
https://redd.it/1mre3iy
@r_bash
Codefile.io
wallpaper_switch.sh — Codefile
Create collaborative code files online for your technical interviews, pair programming, teaching, etc.
how do you toogle capslock using the cmd setxkbmap?
Hi, I'd like to add an alias for toogle caps. in this way I will can reverse the cmd:
alias M='setxkbmap -option caps:escape'
and put in work the capslock key again doing again capslock and not more escape.
Thank you and regards!
https://redd.it/1mrsu2m
@r_bash
Hi, I'd like to add an alias for toogle caps. in this way I will can reverse the cmd:
alias M='setxkbmap -option caps:escape'
and put in work the capslock key again doing again capslock and not more escape.
Thank you and regards!
https://redd.it/1mrsu2m
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
I created an Fortune 500 enterprise wide product utilizing -only- BASH noscript
Finally some utility from learning BASH. Gonna be honest though, I used AI to remind me syntax. Its been a while since I was a linux admin.
Its an alerting solution for business functions that need immediate support.
That is all. Just feels good to utilize a closet skill.
https://redd.it/1mt89q2
@r_bash
Finally some utility from learning BASH. Gonna be honest though, I used AI to remind me syntax. Its been a while since I was a linux admin.
Its an alerting solution for business functions that need immediate support.
That is all. Just feels good to utilize a closet skill.
https://redd.it/1mt89q2
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
posting my setup noscript for backup/revert/log
just put this in a noscript called setup, then run it using . ./setup (make sure you are inside of your target new directory for your project): Then you have a nice menu to get to your directory setup. The internal directories will be named by ranked date-time.
I have been using this setup for my work in JavaScript. I could be adaptable to other workflows with small total filesize. There is no compression happening.
The purpose of this type of backup/revert situation is to be able to very freely experiment with the code.
I have been thinking, just now about severing the BASH noscripts from my project and setting them up in their own repo with an empty example directory structure.
Let me know what you think about it.
You end up with a menu system in the home directory. The menu will be accessible by '. ./menu' and then the directory name.
If you choose directory names with a unique first letter, then you are 'TABBING' you way in.
`
mkdir work;
cd work;
echo 'cd $(cat recentdirectory);' > resume;
chmod 755 resume;
echo "cd work; . ./resume;" > ../start;
chmod 755 ../start;
echo "cd '$(pwd)'; . ./resume;" > ~/menu$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.*\///g'));
chmod 755 ~/menu$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.\///g'));
echo "cd '$(pwd)'; . ./resume; explorer .;" > ~/menux_$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.\///g'));
chmod 755 ~/menux$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.*\///g'));
mkdir 202406June30Sunday024053;
echo './work/202406June30Sunday024406' > 202406June30Sunday024053/.precedingdirectory;
mkdir 202406June30Sunday024406;
echo './work/202406June30Sunday024406' > recentdirectory;
echo './work/202406June30Sunday024053' > 202406June30Sunday024406/.precedingdirectory;
cd 202406June30Sunday024406/;
echo 'cd $(cat .precedingdirectory); mv precedingdirectory .precedingdirectory; mv succeedingdirectory succeedingdirectoryreverted; . ./backup; rm succeedingdirectoryreverted;' > revert;
chmod 755 revert;
echo "mv .precedingdirectory precedingdirectory; echo '../'\$(date +%Y%m%B%d%A%H%M%S)'/' > succeedingdirectory; mkdir \$(echo \$(cat succeedingdirectory)); mv precedingdirectory tmp; echo \$(pwd) > precedingdirectory; cp -r * \$(echo \$(cat succeedingdirectory)); mv tmp precedingdirectory; cd \$(echo \$(cat succeedingdirectory)); rm tmp; rm succeedingdirectory; echo \$(pwd) > ../recentdirectory; mv precedingdirectory .precedingdirectory;" > backup;
chmod 755 backup;
echo 'echo >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo "echo ' # # # # # # # # # # # # # # #' >> ../logfile;" >> log;
echo "echo ' # #' >> ../logfile;" >> log;
echo "echo ' # '\$(date +'%Y/%m/%d %H:%M:%S')' #' >> ../logfile;" >> log;
echo "echo ' # #' >> ../logfile;" >> log;
echo "echo ' # # # # # # # # # # # # # # #' >> ../logfile;" >> log;
echo "echo >> ../logfile;" >> log;
echo 'echo $(pwd) >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo 'vi + ../logfile;' >> log;
chmod 755 log;
. ./backup;
echo ' ' > ../logfile;
echo ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # Assalamu Alaikum, # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # To get back into the most recent directory # ' >> ../logfile;
echo ' # use the following commands at the prompt: # ' >> ../logfile;
echo ' #
just put this in a noscript called setup, then run it using . ./setup (make sure you are inside of your target new directory for your project): Then you have a nice menu to get to your directory setup. The internal directories will be named by ranked date-time.
I have been using this setup for my work in JavaScript. I could be adaptable to other workflows with small total filesize. There is no compression happening.
The purpose of this type of backup/revert situation is to be able to very freely experiment with the code.
I have been thinking, just now about severing the BASH noscripts from my project and setting them up in their own repo with an empty example directory structure.
Let me know what you think about it.
You end up with a menu system in the home directory. The menu will be accessible by '. ./menu' and then the directory name.
If you choose directory names with a unique first letter, then you are 'TABBING' you way in.
`
mkdir work;
cd work;
echo 'cd $(cat recentdirectory);' > resume;
chmod 755 resume;
echo "cd work; . ./resume;" > ../start;
chmod 755 ../start;
echo "cd '$(pwd)'; . ./resume;" > ~/menu$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.*\///g'));
chmod 755 ~/menu$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.\///g'));
echo "cd '$(pwd)'; . ./resume; explorer .;" > ~/menux_$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.\///g'));
chmod 755 ~/menux$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.*\///g'));
mkdir 202406June30Sunday024053;
echo './work/202406June30Sunday024406' > 202406June30Sunday024053/.precedingdirectory;
mkdir 202406June30Sunday024406;
echo './work/202406June30Sunday024406' > recentdirectory;
echo './work/202406June30Sunday024053' > 202406June30Sunday024406/.precedingdirectory;
cd 202406June30Sunday024406/;
echo 'cd $(cat .precedingdirectory); mv precedingdirectory .precedingdirectory; mv succeedingdirectory succeedingdirectoryreverted; . ./backup; rm succeedingdirectoryreverted;' > revert;
chmod 755 revert;
echo "mv .precedingdirectory precedingdirectory; echo '../'\$(date +%Y%m%B%d%A%H%M%S)'/' > succeedingdirectory; mkdir \$(echo \$(cat succeedingdirectory)); mv precedingdirectory tmp; echo \$(pwd) > precedingdirectory; cp -r * \$(echo \$(cat succeedingdirectory)); mv tmp precedingdirectory; cd \$(echo \$(cat succeedingdirectory)); rm tmp; rm succeedingdirectory; echo \$(pwd) > ../recentdirectory; mv precedingdirectory .precedingdirectory;" > backup;
chmod 755 backup;
echo 'echo >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo "echo ' # # # # # # # # # # # # # # #' >> ../logfile;" >> log;
echo "echo ' # #' >> ../logfile;" >> log;
echo "echo ' # '\$(date +'%Y/%m/%d %H:%M:%S')' #' >> ../logfile;" >> log;
echo "echo ' # #' >> ../logfile;" >> log;
echo "echo ' # # # # # # # # # # # # # # #' >> ../logfile;" >> log;
echo "echo >> ../logfile;" >> log;
echo 'echo $(pwd) >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo 'vi + ../logfile;' >> log;
chmod 755 log;
. ./backup;
echo ' ' > ../logfile;
echo ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # Assalamu Alaikum, # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # To get back into the most recent directory # ' >> ../logfile;
echo ' # use the following commands at the prompt: # ' >> ../logfile;
echo ' #
posting my setup noscript for backup/revert/log
just put this in a noscript called setup, then run it using . ./setup (make sure you are inside of your target new directory for your project): Then you have a nice menu to get to your directory setup. The internal directories will be named by ranked date-time.
I have been using this setup for my work in JavaScript. I could be adaptable to other workflows with small total filesize. There is no compression happening.
The purpose of this type of backup/revert situation is to be able to very freely experiment with the code.
I have been thinking, just now about severing the BASH noscripts from my project and setting them up in their own repo with an empty example directory structure.
Let me know what you think about it.
You end up with a menu system in the home directory. The menu will be accessible by '. ./menu_' and then the directory name.
If you choose directory names with a unique first letter, then you are 'TABBING' you way in.
`
mkdir work;
cd work;
echo 'cd $(cat recent_directory);' > resume;
chmod 755 resume;
echo "cd work; . ./resume;" > ../start;
chmod 755 ../start;
echo "cd '$(pwd)'; . ./resume;" > ~/menu_$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.*\///g'));
chmod 755 ~/menu_$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.*\///g'));
echo "cd '$(pwd)'; . ./resume; explorer .;" > ~/menux_$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.*\///g'));
chmod 755 ~/menux_$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.*\///g'));
mkdir 2024_06_June_30_Sunday_02_40_53;
echo './work/2024_06_June_30_Sunday_02_44_06' > 2024_06_June_30_Sunday_02_40_53/.preceding_directory;
mkdir 2024_06_June_30_Sunday_02_44_06;
echo './work/2024_06_June_30_Sunday_02_44_06' > recent_directory;
echo './work/2024_06_June_30_Sunday_02_40_53' > 2024_06_June_30_Sunday_02_44_06/.preceding_directory;
cd 2024_06_June_30_Sunday_02_44_06/;
echo 'cd $(cat .preceding_directory); mv preceding_directory .preceding_directory; mv succeeding_directory succeeding_directory_reverted; . ./backup; rm succeeding_directory_reverted;' > revert;
chmod 755 revert;
echo "mv .preceding_directory preceding_directory; echo '../'\$(date +%Y_%m_%B_%d_%A_%H_%M_%S)'/' > succeeding_directory; mkdir \$(echo \$(cat succeeding_directory)); mv preceding_directory tmp; echo \$(pwd) > preceding_directory; cp -r * \$(echo \$(cat succeeding_directory)); mv tmp preceding_directory; cd \$(echo \$(cat succeeding_directory)); rm tmp; rm succeeding_directory; echo \$(pwd) > ../recent_directory; mv preceding_directory .preceding_directory;" > backup;
chmod 755 backup;
echo 'echo >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo "echo ' # # # # # # # # # # # # # # #' >> ../logfile;" >> log;
echo "echo ' # #' >> ../logfile;" >> log;
echo "echo ' # '\$(date +'%Y/%m/%d %H:%M:%S')' #' >> ../logfile;" >> log;
echo "echo ' # #' >> ../logfile;" >> log;
echo "echo ' # # # # # # # # # # # # # # #' >> ../logfile;" >> log;
echo "echo >> ../logfile;" >> log;
echo 'echo $(pwd) >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo 'vi + ../logfile;' >> log;
chmod 755 log;
. ./backup;
echo ' ' > ../logfile;
echo ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # Assalamu Alaikum, # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # To get back into the most recent directory # ' >> ../logfile;
echo ' # use the following commands at the prompt: # ' >> ../logfile;
echo ' #
just put this in a noscript called setup, then run it using . ./setup (make sure you are inside of your target new directory for your project): Then you have a nice menu to get to your directory setup. The internal directories will be named by ranked date-time.
I have been using this setup for my work in JavaScript. I could be adaptable to other workflows with small total filesize. There is no compression happening.
The purpose of this type of backup/revert situation is to be able to very freely experiment with the code.
I have been thinking, just now about severing the BASH noscripts from my project and setting them up in their own repo with an empty example directory structure.
Let me know what you think about it.
You end up with a menu system in the home directory. The menu will be accessible by '. ./menu_' and then the directory name.
If you choose directory names with a unique first letter, then you are 'TABBING' you way in.
`
mkdir work;
cd work;
echo 'cd $(cat recent_directory);' > resume;
chmod 755 resume;
echo "cd work; . ./resume;" > ../start;
chmod 755 ../start;
echo "cd '$(pwd)'; . ./resume;" > ~/menu_$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.*\///g'));
chmod 755 ~/menu_$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.*\///g'));
echo "cd '$(pwd)'; . ./resume; explorer .;" > ~/menux_$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.*\///g'));
chmod 755 ~/menux_$(echo $(pwd | sed 's/\/work$//g' | sed 's/^.*\///g'));
mkdir 2024_06_June_30_Sunday_02_40_53;
echo './work/2024_06_June_30_Sunday_02_44_06' > 2024_06_June_30_Sunday_02_40_53/.preceding_directory;
mkdir 2024_06_June_30_Sunday_02_44_06;
echo './work/2024_06_June_30_Sunday_02_44_06' > recent_directory;
echo './work/2024_06_June_30_Sunday_02_40_53' > 2024_06_June_30_Sunday_02_44_06/.preceding_directory;
cd 2024_06_June_30_Sunday_02_44_06/;
echo 'cd $(cat .preceding_directory); mv preceding_directory .preceding_directory; mv succeeding_directory succeeding_directory_reverted; . ./backup; rm succeeding_directory_reverted;' > revert;
chmod 755 revert;
echo "mv .preceding_directory preceding_directory; echo '../'\$(date +%Y_%m_%B_%d_%A_%H_%M_%S)'/' > succeeding_directory; mkdir \$(echo \$(cat succeeding_directory)); mv preceding_directory tmp; echo \$(pwd) > preceding_directory; cp -r * \$(echo \$(cat succeeding_directory)); mv tmp preceding_directory; cd \$(echo \$(cat succeeding_directory)); rm tmp; rm succeeding_directory; echo \$(pwd) > ../recent_directory; mv preceding_directory .preceding_directory;" > backup;
chmod 755 backup;
echo 'echo >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo "echo ' # # # # # # # # # # # # # # #' >> ../logfile;" >> log;
echo "echo ' # #' >> ../logfile;" >> log;
echo "echo ' # '\$(date +'%Y/%m/%d %H:%M:%S')' #' >> ../logfile;" >> log;
echo "echo ' # #' >> ../logfile;" >> log;
echo "echo ' # # # # # # # # # # # # # # #' >> ../logfile;" >> log;
echo "echo >> ../logfile;" >> log;
echo 'echo $(pwd) >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo 'echo >> ../logfile;' >> log;
echo 'vi + ../logfile;' >> log;
chmod 755 log;
. ./backup;
echo ' ' > ../logfile;
echo ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # Assalamu Alaikum, # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # To get back into the most recent directory # ' >> ../logfile;
echo ' # use the following commands at the prompt: # ' >> ../logfile;
echo ' #
# ' >> ../logfile;
echo ' # From the BASH startup directory press this: # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # . ./menu_ then press <tab> # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # cd ~ will return to the # ' >> ../logfile;
echo ' # starting directory. # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # From /name/ directory press this: # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # . ./start # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # From /name/work/ directory use this: # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # . ./resume # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # Using the backup and revert noscripts is easy, # ' >> ../logfile;
echo ' # just press these from within the directory # ' >> ../logfile;
echo ' # system that has been prepared: # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # . ./backup (use before experimenting) # ' >> ../logfile;
echo ' # . ./revert (use to restore previous ) # ' >> ../logfile;
echo ' # . ./log (use this to make notes ) # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' >> ../logfile;
cat ../logfile;
echo ' # # ' >> ../logfile;
echo ' # BEGINNING OF LOGFILE # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' >> ../logfile;
. ./log;
`
Best wishes,
-dckimGUY
https://redd.it/1mufr6p
@r_bash
echo ' # From the BASH startup directory press this: # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # . ./menu_ then press <tab> # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # cd ~ will return to the # ' >> ../logfile;
echo ' # starting directory. # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # From /name/ directory press this: # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # . ./start # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # From /name/work/ directory use this: # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # . ./resume # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # Using the backup and revert noscripts is easy, # ' >> ../logfile;
echo ' # just press these from within the directory # ' >> ../logfile;
echo ' # system that has been prepared: # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # . ./backup (use before experimenting) # ' >> ../logfile;
echo ' # . ./revert (use to restore previous ) # ' >> ../logfile;
echo ' # . ./log (use this to make notes ) # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' >> ../logfile;
cat ../logfile;
echo ' # # ' >> ../logfile;
echo ' # BEGINNING OF LOGFILE # ' >> ../logfile;
echo ' # # ' >> ../logfile;
echo ' # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ' >> ../logfile;
. ./log;
`
Best wishes,
-dckimGUY
https://redd.it/1mufr6p
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Recaller: A fast command-line tool to recall your bash history with absolute precision & instant command documentation
Hi, community, we are open-sourcing a Go terminal application called **Recaller** that fetches command history based on your actions.
https://github.com/cybrota/recaller
Recaller suggests shell history (bash) based on recency & frequency making things more relevant for you. It also provides documentation to various types of commands (K8s, Docker, Linux man pages, AWS CLI etc.) instantly for options reference and learning.
Combined with a fuzzer like `fzf`, curated history shows up right in the shell. App is < 5 MB in size, and runs locally. The tool uses optimization techniques (AVL-trees & Caching) to achieve its lookup speeds.
https://redd.it/1mukkjp
@r_bash
Hi, community, we are open-sourcing a Go terminal application called **Recaller** that fetches command history based on your actions.
https://github.com/cybrota/recaller
Recaller suggests shell history (bash) based on recency & frequency making things more relevant for you. It also provides documentation to various types of commands (K8s, Docker, Linux man pages, AWS CLI etc.) instantly for options reference and learning.
Combined with a fuzzer like `fzf`, curated history shows up right in the shell. App is < 5 MB in size, and runs locally. The tool uses optimization techniques (AVL-trees & Caching) to achieve its lookup speeds.
https://redd.it/1mukkjp
@r_bash
GitHub
GitHub - cybrota/recaller: A blazing fast, command-line term-ui app to recall your shell history with absolute precision
A blazing fast, command-line term-ui app to recall your shell history with absolute precision - cybrota/recaller
Aliasses yes or No?
Hi! I was thinking Is it better to use or not alias?
They accelerate the writing of commands but makes us forget the original, complete, long command.
I think: And... if we have to be on another PC without those alias put in the ~/.bashrc, how do we remember the original command?
Thanks and Regards!
https://redd.it/1mvcswc
@r_bash
Hi! I was thinking Is it better to use or not alias?
They accelerate the writing of commands but makes us forget the original, complete, long command.
I think: And... if we have to be on another PC without those alias put in the ~/.bashrc, how do we remember the original command?
Thanks and Regards!
https://redd.it/1mvcswc
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Why my PS1 is acting like this ?
After configuring my
But when I start using it, this happens:
For this example, I decided to type only one letter to observe the behavior. What happens is that when the text I'm typing reaches a point on the screen that isn't even the end of the line, it starts to overwrite the PS1 on the same line. This is probably caused by a miscalculation of the space, I guess.
I don't get it — maybe a skill issue on my part made me misunderstand this, but here is my
I isolated some functions, and what I understand is that the
https://redd.it/1mveqbg
@r_bash
After configuring my
.bashrc, it looks like this:➜ ~daniel~ git:( )
But when I start using it, this happens:
aaaaaaniel~ git:( ) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
For this example, I decided to type only one letter to observe the behavior. What happens is that when the text I'm typing reaches a point on the screen that isn't even the end of the line, it starts to overwrite the PS1 on the same line. This is probably caused by a miscalculation of the space, I guess.
I don't get it — maybe a skill issue on my part made me misunderstand this, but here is my
.bashrc. If anyone knows how to fix that:_format_dir() {
original_user="${SUDO_USER:-$USER}"
original_home=$(getent passwd "${original_user}" | cut -d: -f6)
user_tag="~${original_user}~"
if [[ "$PWD" == "$original_home" ]]; then
echo -n "$user_tag"
elif [[ "$PWD" == "$original_home/"* ]]; then
rel_path="${PWD#$original_home/}"
IFS='/' read -r -a parts <<< "${rel_path}"
part_count="${#parts[@]}"
if (( part_count <= 2 )); then
echo -n "~/$rel_path"
else
echo -n "~/.../${parts[-1]}"
fi
else
echo -n "$PWD"
fi
}
get_git_info() {
if git rev-parse --git-dir > /dev/null 2>&1; then
branch=$(git branch --show-current 2>/dev/null)
if [ -n "$branch" ]; then
printf "\ue0a0 $branch"
else
printf ""
fi
else
printf ""
fi
}
if [[ $EUID -eq 0 ]]; then
export PS1="\n\[\e[1m\]\[\033[38;2;194;114;126m\]➜\[\e[0m\] \[$(tput sgr0)\] \[$(tput bold)\]\[\033[38;2;220;124;126m\]root\[$(tput sgr0)\] in \[$(tput bold)\]\[\033[38;2;72;205;232m\]\$(_format_dir)\[$(tput sgr0)\] \[\001\033[1m\033[38;2;66;99;105m\002\]git:(\[\033[38;2;194;114;126m\]\$(get_git_info)\[\001\033[38;2;66;99;105m\002\])\001\033[0m\002\033[22m "
else
export PS1="\n\[\e[1m\]\[\033[38;2;194;114;126m\]➜\[\e[0m\] \[$(tput sgr0)\] \[$(tput bold)\]\[\033[38;2;72;205;232m\]\$(_format_dir)\[$(tput sgr0)\] \[\001\033[1m\033[38;2;66;99;105m\002\]git:(\[\033[38;2;194;114;126m\]\$(get_git_info)\[\001\033[38;2;66;99;105m\002\])\001\033[0m\002\033[22m "
fi
I isolated some functions, and what I understand is that the
get_git_info() function is the problem. I can't make it work properly.https://redd.it/1mveqbg
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Does anyone use local uncompressed backup? Git-everything-always? Or layered approach?
I'm just wondering... I am new to Git, about three weeks in. Does anyone out there use a local uncompressed backup system for fast backups and reversions? Or is the Git-everything philosophy the best route?
I have been reading up on it and it seems like there is something useful about having a local reversion system outside of Git. Something simpler. Something closer to a 'layered approach'.
Write me a line.
Thanks,
-dckimGUY
https://redd.it/1mw2ujo
@r_bash
I'm just wondering... I am new to Git, about three weeks in. Does anyone out there use a local uncompressed backup system for fast backups and reversions? Or is the Git-everything philosophy the best route?
I have been reading up on it and it seems like there is something useful about having a local reversion system outside of Git. Something simpler. Something closer to a 'layered approach'.
Write me a line.
Thanks,
-dckimGUY
https://redd.it/1mw2ujo
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Bash Librewolf Installation
Github Repository: InstallScripts
Created a bash noscript that supports all the distros that librewolf ( privacy focused fork of firefox ) supports and I finished the noscript just need to test it on the other distros using docker, so far Debian, fedora and opensuse were successful.
https://redd.it/1mwsvo4
@r_bash
Github Repository: InstallScripts
Created a bash noscript that supports all the distros that librewolf ( privacy focused fork of firefox ) supports and I finished the noscript just need to test it on the other distros using docker, so far Debian, fedora and opensuse were successful.
https://redd.it/1mwsvo4
@r_bash
GitHub
GitHub - GitXpresso/InstallScripts: Bash noscripts that used the steps on to install a package example: librewolf for the other distro's…
Bash noscripts that used the steps on to install a package example: librewolf for the other distro's that the package is available too. - GitXpresso/InstallScripts
Prompt that repeats until user give correct input ( while loop )
Here's is an example of the code
while true; do
read -p "Would you like to continue? (yes/no): " yesorno # Outputs a Prompt
if "$yes_or_no" == "yes" ; then
echo "Continuing with the noscript..."
elif "$yes_or_no" == "no" ; then
echo "Not continuing with the noscript, exiting..."
exit 1
else # Executes if user does input "yes or no"
echo "Invalid input, try again..."
clear # clears the terminal
fi # ending block for the if statement
done # ending block for while loop
look at [Github: InstallScripts\](https://github.com/gitxpresso/InstallScripts)
https://redd.it/1mwt31f
@r_bash
Here's is an example of the code
while true; do
read -p "Would you like to continue? (yes/no): " yesorno # Outputs a Prompt
if "$yes_or_no" == "yes" ; then
echo "Continuing with the noscript..."
elif "$yes_or_no" == "no" ; then
echo "Not continuing with the noscript, exiting..."
exit 1
else # Executes if user does input "yes or no"
echo "Invalid input, try again..."
clear # clears the terminal
fi # ending block for the if statement
done # ending block for while loop
look at [Github: InstallScripts\](https://github.com/gitxpresso/InstallScripts)
https://redd.it/1mwt31f
@r_bash
GitHub
GitHub - GitXpresso/InstallScripts: Bash noscripts that used the steps on to install a package example: librewolf for the other distro's…
Bash noscripts that used the steps on to install a package example: librewolf for the other distro's that the package is available too. - GitXpresso/InstallScripts
What safe config file format do you recommend?
I don't want to source something in case it executes code. For now I am using json and jq. I would use yaml instead but yq isn't among programs I can justify installing
I could parse a text file. Sugestions? I just need key and value.
https://redd.it/1myf0xk
@r_bash
I don't want to source something in case it executes code. For now I am using json and jq. I would use yaml instead but yq isn't among programs I can justify installing
I could parse a text file. Sugestions? I just need key and value.
https://redd.it/1myf0xk
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Does anyone use select menus?
They looked like a useful feature at first, but then I realized that select only prints the prompt ($PS3) but not the list. If whatever command you ran before prints a lot of text to stderr/stdout, you will not be able to see the list of options.
https://redd.it/1myi7zd
@r_bash
They looked like a useful feature at first, but then I realized that select only prints the prompt ($PS3) but not the list. If whatever command you ran before prints a lot of text to stderr/stdout, you will not be able to see the list of options.
https://redd.it/1myi7zd
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community