Symlinks with spaces in folder name
The following works except for folders with spaces in the name.
#!/bin/bash
cd /var/packages || exit
while read -r link target; do
echo "link: $link" # debug
echo -e "target: $target \n" # debug
done < <(find . -maxdepth 2 -type l -ls | grep volume | grep target | cut -d'.' -f2- | sed 's/ ->//')
Like "Plex Media Server":
link: /Docker/target
target: /volume1/@appstore/Docker
link: /Plex\
target: Media\ Server/target /volume1/@appstore/Plex\ Media\ Server
Instead of:
link: /Plex\ Media\ Server/target
target: /volume1/@appstore/Plex\ Media\ Server
What am I doing wrong?
​
https://redd.it/1fylclc
@r_bash
The following works except for folders with spaces in the name.
#!/bin/bash
cd /var/packages || exit
while read -r link target; do
echo "link: $link" # debug
echo -e "target: $target \n" # debug
done < <(find . -maxdepth 2 -type l -ls | grep volume | grep target | cut -d'.' -f2- | sed 's/ ->//')
Like "Plex Media Server":
link: /Docker/target
target: /volume1/@appstore/Docker
link: /Plex\
target: Media\ Server/target /volume1/@appstore/Plex\ Media\ Server
Instead of:
link: /Plex\ Media\ Server/target
target: /volume1/@appstore/Plex\ Media\ Server
What am I doing wrong?
​
https://redd.it/1fylclc
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Assistance requested with a backup noscript for an Android tablet
BACKGROUND:
I have been endeavouring to update my Android tablet with different versions of this noscript and even before I set my mind on realising this noscript in particular and have been at it for quite some time, but I have so far not been completely successful. It is almost there.
My Termux Linux userland environment is a bit of a legacy ecosystem. I have tried to set up my system well, but there are anomalies and inconsistencies. I have just been teaching myself and learning on the fly.
In executing earlier versions of this noscript, it kept on maxing out the memory of my microSD, but there should have been more than ample space. The backup directories would be hundreds of times larger than the size of the original source directories. I realised it was infinite loops caused by nested symbolic links and probably other reasons that I have not yet identified. This is the reason for the structure of the noscript and the excessive logging.
The problems are few (I hope):
1. A virulent unbounded variable in the backup_files array. I just haven't been able to fix it and I don't know why.
2. I had a lot of problems with terminating all the spawned processes. Some of them were really sneaky. Hence, the KILLSWITCH. But I just can't get it to work and I don't know why.
https://pastebin.com/QrHgCiQ4
Any assistance to help me bash this into shape would be most appreciated.
https://redd.it/1fykj4r
@r_bash
BACKGROUND:
I have been endeavouring to update my Android tablet with different versions of this noscript and even before I set my mind on realising this noscript in particular and have been at it for quite some time, but I have so far not been completely successful. It is almost there.
My Termux Linux userland environment is a bit of a legacy ecosystem. I have tried to set up my system well, but there are anomalies and inconsistencies. I have just been teaching myself and learning on the fly.
In executing earlier versions of this noscript, it kept on maxing out the memory of my microSD, but there should have been more than ample space. The backup directories would be hundreds of times larger than the size of the original source directories. I realised it was infinite loops caused by nested symbolic links and probably other reasons that I have not yet identified. This is the reason for the structure of the noscript and the excessive logging.
The problems are few (I hope):
1. A virulent unbounded variable in the backup_files array. I just haven't been able to fix it and I don't know why.
2. I had a lot of problems with terminating all the spawned processes. Some of them were really sneaky. Hence, the KILLSWITCH. But I just can't get it to work and I don't know why.
https://pastebin.com/QrHgCiQ4
Any assistance to help me bash this into shape would be most appreciated.
https://redd.it/1fykj4r
@r_bash
Pastebin
persistent_integrity_validation_backup8.sh - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
How do I delete letters in vi bash?
Made this MESS of D’s and A’s now I don’t know how to delete it. Pressing X just replaces the letter and the delete button doesn’t work. Please help.
https://redd.it/1fyphnr
@r_bash
Made this MESS of D’s and A’s now I don’t know how to delete it. Pressing X just replaces the letter and the delete button doesn’t work. Please help.
https://redd.it/1fyphnr
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How to make a symbolic link to file with exclamation point '!' in directory?
The file is located in:
Same output results when placing a single quotation around first exclamation point.
I add quote around the first exclamation point plus one backslash before:
ls -lh displays:
When I instead just do a backslash:
ls -lh displays:
https://redd.it/1fz1t4h
@r_bash
The file is located in:
/media/hdd2/video/Title 1!/noscript 1!.mp4ln -sn "/media/hdd2/video/Title 1!/noscript 1!.mp4" "noscript 1!".mp4 results in: bash: !/Title: event not foundSame output results when placing a single quotation around first exclamation point.
I add quote around the first exclamation point plus one backslash before:
/media/hdd2/video/Title 1'\!'/noscript 1!.mp4ls -lh displays:
noscript 1!.mp4 -> '/media/hdd2/video/Title 1'\''\!'\''/noscript 1!.mp4'When I instead just do a backslash:
/media/hdd2/video/Title 1\!/noscript 1!.mp4ls -lh displays:
noscript 1!.mp4 -> /media/hdd2/video/Title 1\!/noscript 1!.mp4https://redd.it/1fz1t4h
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Suitable projects to make using bash/linux POSIX commands?
https://en.wikipedia.org/wiki/List_of_POSIX_commands
I've created about 5 short noscripts. They're related to :
- SSL certificate expiry monitor and alert system
- Hangman trivia game
- Weather api redirection and check today's weather
and so on.
I want to indulge into something interesting now. I am a beginner (only 1 yoe with linux sysadmin and slowly starting noscripting)..
Someone suggested that I should write my own netcat? nmap? However, my interests doesn't lie there. I like to make games, guis, and and do data analysis using awk etc.
I like something that is practically applicable and suitable for bash as well. Something, I can use for real applications. SSL certificate expiry checker was one of them I really loved.
https://redd.it/1fz2ryj
@r_bash
https://en.wikipedia.org/wiki/List_of_POSIX_commands
I've created about 5 short noscripts. They're related to :
- SSL certificate expiry monitor and alert system
- Hangman trivia game
- Weather api redirection and check today's weather
and so on.
I want to indulge into something interesting now. I am a beginner (only 1 yoe with linux sysadmin and slowly starting noscripting)..
Someone suggested that I should write my own netcat? nmap? However, my interests doesn't lie there. I like to make games, guis, and and do data analysis using awk etc.
I like something that is practically applicable and suitable for bash as well. Something, I can use for real applications. SSL certificate expiry checker was one of them I really loved.
https://redd.it/1fz2ryj
@r_bash
Changing color theme codes
Hello everybody. Sorry for bad format, just started to learn this stuff.
My google-fu has failed me, so i am asking for advice here.
I know how to set color scheme in tty, by adding something like
or with echo
and i have added this to my .bashrc
But this method does not work for terminal emulators.
Closest i got was with
but i can not change color codes for other 0-15 colors.
I have also tried googh, but that just downloads theme profiles, and i cant save that in bashrc for portability.
Anyway. Any help is welcome.
https://redd.it/1fz2yy9
@r_bash
Hello everybody. Sorry for bad format, just started to learn this stuff.
My google-fu has failed me, so i am asking for advice here.
I know how to set color scheme in tty, by adding something like
if [ "$TERM" = "linux" ]; then\printf %b '\\e\]P0282a36' # redefine 'black'``\printf %b '\\e\]P86272a4' # redefine 'bright-black'``...fior with echo
echo -en "\e]P0222222" #blackecho -en "\e]P8666666" #darkgrey....and i have added this to my .bashrc
But this method does not work for terminal emulators.
Closest i got was with
echo -ne '\e]11;#808080\e\\' # change backgroundecho -ne '\e]10;#000000\e\\' # change foregroundbut i can not change color codes for other 0-15 colors.
I have also tried googh, but that just downloads theme profiles, and i cant save that in bashrc for portability.
Anyway. Any help is welcome.
https://redd.it/1fz2yy9
@r_bash
GitHub
GitHub - Gogh-Co/Gogh: Gogh is a collection of color schemes for various terminal emulators, including Gnome Terminal, Pantheon…
Gogh is a collection of color schemes for various terminal emulators, including Gnome Terminal, Pantheon Terminal, Tilix, and XFCE4 Terminal also compatible with iTerm on macOS. - Gogh-Co/Gogh
How to style text with code?
How to style text with code? I've been using
but I don't want litter the noscript with lots of call to the
P.S. Is a small library of util functions worth using? Should you develop your own over time and work out kinks yourself or is there a public repo of well-written util functions that is "good enough"?
https://redd.it/1fz9pxm
@r_bash
How to style text with code? I've been using
tput like this:echo "$(tput setaf 1)some text$(tput sgr0)"but I don't want litter the noscript with lots of call to the
tput external command it seems excessive to fork/exec for such trivial things. Would like something more efficient and human-readable. Interested in solutions that are bash-specific as well as something that's more posix-compliant.P.S. Is a small library of util functions worth using? Should you develop your own over time and work out kinks yourself or is there a public repo of well-written util functions that is "good enough"?
https://redd.it/1fz9pxm
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How do I pass multiple arguments to pandoc
I would like to pass multiple file paths to my pandoc noscript.
This is what I came up with:
TLDR: It looks for all files matching `01 manunoscripts/*/*` and puts them in a file separated by a new line. It then reads the file and adds each line to args. Then it gives the args to pandoc.
#!/bin/bash
# Create an output directory if it doesn't exist
mkdir -p .output
# Create an empty file to hold the list of ordered files
> ordered_files.txt
# List all unique file names inside the "manunoscript" folder, handling spaces in filenames
find 01\ manunoscripts/*/* -type f -exec basename {} \; | sort -u | while IFS= read -r file; do
# Find all instances of the file in subdirectories, handling spaces
find 01\ manunoscripts/*/* -type f -name "$file" -print0 | sort -z | while IFS= read -r -d '' filepath; do
echo "$filepath" >> ordered_files.txt
done
done
# Initialize an empty variable to hold all the arguments
args=""
# Read each line from the file a.txt
while IFS= read -r line
do
# Append each argument with proper quoting
args+="\"$line\" "
done < ordered_files.txt
echo $args
# Run pandoc on the ordered list of files
pandoc --top-level-division=chapter --toc -o .output/output.pdf noscript.md $args
# Open the generated PDF
open .output/output.pdf
# Clean up the temporary file
The problem is that pandoc is not recognizing the quotes around my argument, and treating the space between the quotes as separate args.
pandoc: "01: withBinaryFile: does not exist (No such file or directory)
The 01 that its refering to is the start of the path, 01 manunoscripts/blah/blah.md
^~~~~~~~~~~~~~~~~~~~~~~~~~
How could I pass dynamic amount of args into pandoc?
https://redd.it/1fzf0um
@r_bash
I would like to pass multiple file paths to my pandoc noscript.
This is what I came up with:
TLDR: It looks for all files matching `01 manunoscripts/*/*` and puts them in a file separated by a new line. It then reads the file and adds each line to args. Then it gives the args to pandoc.
#!/bin/bash
# Create an output directory if it doesn't exist
mkdir -p .output
# Create an empty file to hold the list of ordered files
> ordered_files.txt
# List all unique file names inside the "manunoscript" folder, handling spaces in filenames
find 01\ manunoscripts/*/* -type f -exec basename {} \; | sort -u | while IFS= read -r file; do
# Find all instances of the file in subdirectories, handling spaces
find 01\ manunoscripts/*/* -type f -name "$file" -print0 | sort -z | while IFS= read -r -d '' filepath; do
echo "$filepath" >> ordered_files.txt
done
done
# Initialize an empty variable to hold all the arguments
args=""
# Read each line from the file a.txt
while IFS= read -r line
do
# Append each argument with proper quoting
args+="\"$line\" "
done < ordered_files.txt
echo $args
# Run pandoc on the ordered list of files
pandoc --top-level-division=chapter --toc -o .output/output.pdf noscript.md $args
# Open the generated PDF
open .output/output.pdf
# Clean up the temporary file
The problem is that pandoc is not recognizing the quotes around my argument, and treating the space between the quotes as separate args.
pandoc: "01: withBinaryFile: does not exist (No such file or directory)
The 01 that its refering to is the start of the path, 01 manunoscripts/blah/blah.md
^~~~~~~~~~~~~~~~~~~~~~~~~~
How could I pass dynamic amount of args into pandoc?
https://redd.it/1fzf0um
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
BASH Tool that helps you solving THM and HTB machines & ctfs
# Hey pentesters & bash guys ,
I wanna share a tool I've been working on that I hope will help you all with THM rooms and HTB machines. It's called Sh0zack and 100 % in BASH
contains customized versions of popular tools like nmap, wfuzz, and linpeas directly within it , Designed specifically for CTFs and practice environments like THM and HTB.
GitHub Repository: https://github.com/sh0z3n/Sh0zack
I'd love for you all to try it out and let me know what you think. Ideas for additional tools or features you'd like to see integrated , Your feedback will be invaluable in making it even better.
usage
https://redd.it/1fzo42b
@r_bash
# Hey pentesters & bash guys ,
I wanna share a tool I've been working on that I hope will help you all with THM rooms and HTB machines. It's called Sh0zack and 100 % in BASH
contains customized versions of popular tools like nmap, wfuzz, and linpeas directly within it , Designed specifically for CTFs and practice environments like THM and HTB.
GitHub Repository: https://github.com/sh0z3n/Sh0zack
I'd love for you all to try it out and let me know what you think. Ideas for additional tools or features you'd like to see integrated , Your feedback will be invaluable in making it even better.
usage
https://redd.it/1fzo42b
@r_bash
GitHub
GitHub - sh0z3n/Sh0zack: Advanced Penetration Testing Framework | Powered by Bash
Advanced Penetration Testing Framework | Powered by Bash - GitHub - sh0z3n/Sh0zack: Advanced Penetration Testing Framework | Powered by Bash
Avoid passing arguments to function until all items have been looped through ?
Hi,
I have the below part of a noscript which gets information from a system which the user inputs.
function rrupreparation ()
{
kubeworker=$1
charu=2024
timez=3
if -z $(ssh -q $kubeworker ssh -q $rruaddr cat /etc/benetel-rootfs-version)
currver=$(ssh -q $kubeworker ssh -q $rruaddr cat /etc/benetel-rootfs-version)
then
if [ $currver == $upgradever ]
then
echo "$rruaddr UPGRADED"
else
echo "$rruaddr NOT UPGRADED"
fi
fi
}
function rruchecks ()
{
kubeworker=$1
rruaddr=$2
if -z $(ssh -q $kubeworker ssh -q $rruaddr cat /etc/benetel-rootfs-version)
currver=$(ssh -q $kubeworker ssh -q $rruaddr cat /etc/benetel-rootfs-version)
then
if [ $currver == $upgradever ]
then
stat="(U)"
tval=TXMeanPower
else
stat="(NU)"
tval=tssi
fi
fi
echo "$stat | $currver | $kubeworker | $rruaddr
rrupreparation $kubeworker
}
function findnodes ()
{
findnodes1=1
for kubeworkers in $allkubes;
do
kubeworker=$( echo $kubeworkers | cut -c 6- )
echo $kubeworker
done
read -p "Find RRU in Worker : " kubeworker
for rruaddr in $(ssh -q $kubeworker arp -n | grep 10.42.8 | grep ether | awk '{print $1}')
do
rruchecks $kubeworker $rruaddr
done
}
findnodes
Script output once run
bai-ran-cluster-worker0
bai-ran-cluster-worker1
bai-ran-cluster-worker2
bai-ran-cluster-worker3
bai-ran-cluster-worker4
bai-ran-cluster-worker5
bai-ran-cluster-worker6
Find RRU in Worker : bai-ran-cluster-worker3 <--- User inputs any name from the above list
So in this case the user input is passed as arguments from
(NU) | RAN650-3V0.8.2patch2 |
NOT UPGRADED
(NU) | RAN650-3V0.8.2patch2 |
NOT UPGRADED
(NU) | RAN650-3V0.8.2patch2 |
NOT UPGRADED10.42.8.3510.42.8.3510.42.8.3610.42.8.3610.42.8.3710.42.8.37
In the above result the 1st line is the expected, the 2nd line is a result of the argument received in
How can I not pass the user input from
https://redd.it/1fzu7as
@r_bash
Hi,
I have the below part of a noscript which gets information from a system which the user inputs.
function rrupreparation ()
{
kubeworker=$1
charu=2024
timez=3
if -z $(ssh -q $kubeworker ssh -q $rruaddr cat /etc/benetel-rootfs-version)
currver=$(ssh -q $kubeworker ssh -q $rruaddr cat /etc/benetel-rootfs-version)
then
if [ $currver == $upgradever ]
then
echo "$rruaddr UPGRADED"
else
echo "$rruaddr NOT UPGRADED"
fi
fi
}
function rruchecks ()
{
kubeworker=$1
rruaddr=$2
if -z $(ssh -q $kubeworker ssh -q $rruaddr cat /etc/benetel-rootfs-version)
currver=$(ssh -q $kubeworker ssh -q $rruaddr cat /etc/benetel-rootfs-version)
then
if [ $currver == $upgradever ]
then
stat="(U)"
tval=TXMeanPower
else
stat="(NU)"
tval=tssi
fi
fi
echo "$stat | $currver | $kubeworker | $rruaddr
rrupreparation $kubeworker
}
function findnodes ()
{
findnodes1=1
for kubeworkers in $allkubes;
do
kubeworker=$( echo $kubeworkers | cut -c 6- )
echo $kubeworker
done
read -p "Find RRU in Worker : " kubeworker
for rruaddr in $(ssh -q $kubeworker arp -n | grep 10.42.8 | grep ether | awk '{print $1}')
do
rruchecks $kubeworker $rruaddr
done
}
findnodes
Script output once run
bai-ran-cluster-worker0
bai-ran-cluster-worker1
bai-ran-cluster-worker2
bai-ran-cluster-worker3
bai-ran-cluster-worker4
bai-ran-cluster-worker5
bai-ran-cluster-worker6
Find RRU in Worker : bai-ran-cluster-worker3 <--- User inputs any name from the above list
So in this case the user input is passed as arguments from
findnodes function to rruchecks function which then checks the system, and gives the below result.(NU) | RAN650-3V0.8.2patch2 |
NOT UPGRADED
(NU) | RAN650-3V0.8.2patch2 |
NOT UPGRADED
(NU) | RAN650-3V0.8.2patch2 |
NOT UPGRADED10.42.8.3510.42.8.3510.42.8.3610.42.8.3610.42.8.3710.42.8.37
In the above result the 1st line is the expected, the 2nd line is a result of the argument received in
rruchecks being passed on to rrupreparation function.How can I not pass the user input from
rruchecks to rrupreparation until all systems have been checked in rruchecks ?https://redd.it/1fzu7as
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
noob here progress bar
I have this simple function in .bashrc:
it works perfectly but no progress bar is shown, why??
https://redd.it/1fzxxl4
@r_bash
I have this simple function in .bashrc:
0x0() { [ -z "$1" -o -r "$1" ] && curl --progress-bar -F"file=@${1:--}" -Fexpires=48 `https://0x0.st` || echo -e "error: bla bla bla"; }it works perfectly but no progress bar is shown, why??
https://redd.it/1fzxxl4
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Stupid question but ...
Hello everyone,
I'm trying to set up a cron job to shut down my students' computers at a fixed time, but it doesn't work: the computers stay on.
I have 3 users on each computer:
Teacher
Student
root
In the "crontab -e" students I enter the following command:
14 17 * * 1-5 /sbin/shutdown -h +1
Thank you in advance for telling me where the error is.
Mark
https://redd.it/1g0gcm9
@r_bash
Hello everyone,
I'm trying to set up a cron job to shut down my students' computers at a fixed time, but it doesn't work: the computers stay on.
I have 3 users on each computer:
Teacher
Student
root
In the "crontab -e" students I enter the following command:
14 17 * * 1-5 /sbin/shutdown -h +1
Thank you in advance for telling me where the error is.
Mark
https://redd.it/1g0gcm9
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How to remove all directories that don't contain specific filetypes?
I've made a bit of mess of my music library and am sorting things with beets.io.
It's leaving behind a lot of cruft.
Is there a command I can run recuresibly that will delete all directories and files do not contain *.flac, *.mp3, *.ogg?
I've got hundreds of folders and subfolders much of which is just extra album art or *.m3u kinda stuff I would love to avoid manually going through them.
https://redd.it/1g0jq93
@r_bash
I've made a bit of mess of my music library and am sorting things with beets.io.
It's leaving behind a lot of cruft.
Is there a command I can run recuresibly that will delete all directories and files do not contain *.flac, *.mp3, *.ogg?
I've got hundreds of folders and subfolders much of which is just extra album art or *.m3u kinda stuff I would love to avoid manually going through them.
https://redd.it/1g0jq93
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
"sudo <command>" doesn't use system wide bash config.
I have created a system wide configuration for bash at /etc/bash.bashrc to format the prompt and source pywal colors so that I don't need to manage a separate config file for root and my user account. However, the colors are only applied when I run a command without elevated privileges. So, it works fine for my user account, and if I actually sign in as root before issuing the command; but if I were to type "sudo ls" while being signed in as my user, the text output remains completely white instead of using my color palette. Can anyone in here explain this behavior and would you be willing to tell me what I need to do to get it working correctly? Here are the contents of my /etc/bash.bashrc:
/etc
$ cat bash.bashrc
# If not running interactively, don't do anything
[ $- != *i* ] && return
# Grab colors from pywal
(cat /home/ego/.cache/wal/sequences &)
source /home/ego/.cache/wal/colors-tty.sh
# Prompt
PS1='\n\w\n\$ '
# Enable color output
alias ls="ls --color=auto"
https://redd.it/1g0ujfr
@r_bash
I have created a system wide configuration for bash at /etc/bash.bashrc to format the prompt and source pywal colors so that I don't need to manage a separate config file for root and my user account. However, the colors are only applied when I run a command without elevated privileges. So, it works fine for my user account, and if I actually sign in as root before issuing the command; but if I were to type "sudo ls" while being signed in as my user, the text output remains completely white instead of using my color palette. Can anyone in here explain this behavior and would you be willing to tell me what I need to do to get it working correctly? Here are the contents of my /etc/bash.bashrc:
/etc
$ cat bash.bashrc
# If not running interactively, don't do anything
[ $- != *i* ] && return
# Grab colors from pywal
(cat /home/ego/.cache/wal/sequences &)
source /home/ego/.cache/wal/colors-tty.sh
# Prompt
PS1='\n\w\n\$ '
# Enable color output
alias ls="ls --color=auto"
https://redd.it/1g0ujfr
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Super simple question - How can I keep Neovim from opening if fzf is closed with <C-c>?
I have a simple alias which uses fzf to search for and open a file in neovim:
This works pretty much exactly as I want it to (although if it could be better I'd love to know how), but if I close the fzf using ctrl+c neovim will still open a new file.
https://redd.it/1g0zbv9
@r_bash
I have a simple alias which uses fzf to search for and open a file in neovim:
alias nv='nvim$(find . -maxdepth 1 -not -type d | fzf --preveiw="cat {}" --tmux)'This works pretty much exactly as I want it to (although if it could be better I'd love to know how), but if I close the fzf using ctrl+c neovim will still open a new file.
https://redd.it/1g0zbv9
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
What boredom does to a man replicating the old TVs 'no signal' color bars in BASH
https://redd.it/1g16wrq
@r_bash
https://redd.it/1g16wrq
@r_bash
I would like to make this less stupid but have no idea of what to use to get the same result.
echo $((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))
the result is a random sequence of number of 0s and 1s
1010010101111111010010110110001011100100100010110110101001101010111001001111110010100101011100101000000011010100111000101101110001111010
https://redd.it/1g1y4i6
@r_bash
echo $((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))
the result is a random sequence of number of 0s and 1s
1010010101111111010010110110001011100100100010110110101001101010111001001111110010100101011100101000000011010100111000101101110001111010
https://redd.it/1g1y4i6
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
A bash banner
https://preview.redd.it/y17eh6ai7eud1.png?width=1142&format=png&auto=webp&s=7a7a7f394fb9996aade20227d11263ea3792e99a
Script here, minus the allergens/uv data since that requires a lot of extra infrastructure:
https://gist.github.com/robbieh/c12d355ea074a7aeef9d847d76ad69f8
This noscript is designed to be run in .bashrc so I get relevant info when I first sit down and open a terminal. After the first time it shows, new terminals will get a much more terse version so that it doesn't become annoying. That resets after an hour.
The noscript contains a way to make a header with figlet and run just about anything to the right of it. That was tricky to work out.
https://redd.it/1g2a7ja
@r_bash
https://preview.redd.it/y17eh6ai7eud1.png?width=1142&format=png&auto=webp&s=7a7a7f394fb9996aade20227d11263ea3792e99a
Script here, minus the allergens/uv data since that requires a lot of extra infrastructure:
https://gist.github.com/robbieh/c12d355ea074a7aeef9d847d76ad69f8
This noscript is designed to be run in .bashrc so I get relevant info when I first sit down and open a terminal. After the first time it shows, new terminals will get a much more terse version so that it doesn't become annoying. That resets after an hour.
The noscript contains a way to make a header with figlet and run just about anything to the right of it. That was tricky to work out.
https://redd.it/1g2a7ja
@r_bash