Why does this attempt to read/write to arrays not work?
!#/bin/bash
declare -a testarray
count=0
testvariable0=dog ; testvariable1=cat
while $count -lt 2
do
testarray$count+="$testvariable$count"
((count++))
done
echo ${testarray0}
echo -e
echo ${testarray1}
I'm going to write a function that i'm going to reuse a lot. The function will be pointed at an arbitary position in an array, so I thought that I could replace the specifying number with the contents of a variable.
To test this, I made this short looping noscript.
Expected output:
dog
cat
actual output:
0
1
What gives?
https://redd.it/16g4e2z
@r_bash
!#/bin/bash
declare -a testarray
count=0
testvariable0=dog ; testvariable1=cat
while $count -lt 2
do
testarray$count+="$testvariable$count"
((count++))
done
echo ${testarray0}
echo -e
echo ${testarray1}
I'm going to write a function that i'm going to reuse a lot. The function will be pointed at an arbitary position in an array, so I thought that I could replace the specifying number with the contents of a variable.
To test this, I made this short looping noscript.
Expected output:
dog
cat
actual output:
0
1
What gives?
https://redd.it/16g4e2z
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
What is your best tool/command to look into log files?
Probably `less` with something like:
bat --style=plain --color=always {FILE_NAME} | less -R
but still wanted to know more if there are any better tools/commands/tricks to do that.
The tools I can think of now:
* `less` \- can provide a very powerful [advanced search](https://man7.org/linux/man-pages/man1/less.1.html#COMMANDS) e.g. using `&` pattern to filter the lines
* `bat` \- colored with the ability to search in the window (probably similar to `less` if uses it as the default pager)
* `cat` and `grep` - I will have to repeat the command more than once and takes more time
* `vim -R` (or `view`) - in read-only mode
https://redd.it/16ga0t9
@r_bash
Probably `less` with something like:
bat --style=plain --color=always {FILE_NAME} | less -R
but still wanted to know more if there are any better tools/commands/tricks to do that.
The tools I can think of now:
* `less` \- can provide a very powerful [advanced search](https://man7.org/linux/man-pages/man1/less.1.html#COMMANDS) e.g. using `&` pattern to filter the lines
* `bat` \- colored with the ability to search in the window (probably similar to `less` if uses it as the default pager)
* `cat` and `grep` - I will have to repeat the command more than once and takes more time
* `vim -R` (or `view`) - in read-only mode
https://redd.it/16ga0t9
@r_bash
I noscript I use to find files broke mysteriously and started adding newlines where spaces in directory name exist.
I have a noscript that searches through a large filesystem, matches file names against search criteria, makes a list of them, hashes them all and eliminates duplicates, and then copies all the files to a directory.
It's breaking now for some odd reason and it seems to be messing up where directory names have spaces, treating the space as a newline. I figure I'm missing a flag or a basic concept, any ideas? Here's the beginning of it:
#!/bin/bash
declare -a FILENAMES
declare -A HASHES
read -p "What are you searching for? " varname
echo Searching for "$varname"
if -d "/mnt/me/output/$varname" ; then
echo "Directory already exists, quitting."
exit
fi
printf "\n"
FILENAMES=( $(find /mnt/archive /mnt/dad -type f -size +512k -iname """$varname""") )
MATCHES=${#FILENAMES@}
echo "Found $MATCHES matches:"
for i in "${FILENAMES@}"
do
echo "$i"
done
I omitted the rest of the code since it is irrelevant. Is find failing me?
https://redd.it/16gje76
@r_bash
I have a noscript that searches through a large filesystem, matches file names against search criteria, makes a list of them, hashes them all and eliminates duplicates, and then copies all the files to a directory.
It's breaking now for some odd reason and it seems to be messing up where directory names have spaces, treating the space as a newline. I figure I'm missing a flag or a basic concept, any ideas? Here's the beginning of it:
#!/bin/bash
declare -a FILENAMES
declare -A HASHES
read -p "What are you searching for? " varname
echo Searching for "$varname"
if -d "/mnt/me/output/$varname" ; then
echo "Directory already exists, quitting."
exit
fi
printf "\n"
FILENAMES=( $(find /mnt/archive /mnt/dad -type f -size +512k -iname """$varname""") )
MATCHES=${#FILENAMES@}
echo "Found $MATCHES matches:"
for i in "${FILENAMES@}"
do
echo "$i"
done
I omitted the rest of the code since it is irrelevant. Is find failing me?
https://redd.it/16gje76
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Quoting strings more resiliently
I wish there were some simple syntax, where we could easily quote strings, and ' and " would not throw it off. It's way too common to use ' and " when typing sentences, accidentally messing up the quoted parameter.
The alternatives, like heredocs, going back and assigning a variable, etc., are not convenient for fast interactive use as you're just quickly trying to get things done. Some syntax like ${this is a string} would be great (I know that one won't work). Possibly one where the delimiting char were selectable, like in perl q/str/, where you set the first char, like q|str| -- this also handles paired char types, e.g. q{str} and q(str). You can even do q\\str\\. (q for single-quote functionality, qq for double-quote functionality) (And, of course, the same provision is available for matches with m// and regex replacements, s/foo/bar/ => s#foo#bar# => s{foo}{bar})
​
https://redd.it/16gl9qz
@r_bash
I wish there were some simple syntax, where we could easily quote strings, and ' and " would not throw it off. It's way too common to use ' and " when typing sentences, accidentally messing up the quoted parameter.
The alternatives, like heredocs, going back and assigning a variable, etc., are not convenient for fast interactive use as you're just quickly trying to get things done. Some syntax like ${this is a string} would be great (I know that one won't work). Possibly one where the delimiting char were selectable, like in perl q/str/, where you set the first char, like q|str| -- this also handles paired char types, e.g. q{str} and q(str). You can even do q\\str\\. (q for single-quote functionality, qq for double-quote functionality) (And, of course, the same provision is available for matches with m// and regex replacements, s/foo/bar/ => s#foo#bar# => s{foo}{bar})
​
https://redd.it/16gl9qz
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Chris's Wiki :: blog/unix/BourneShellObscureErrorRoots
https://utcc.utoronto.ca/~cks/space/blog/unix/BourneShellObscureErrorRoots?showcomments#comments
https://redd.it/16gpt4a
@r_bash
https://utcc.utoronto.ca/~cks/space/blog/unix/BourneShellObscureErrorRoots?showcomments#comments
https://redd.it/16gpt4a
@r_bash
Question on subshell
Hi everyone ,
I'm currently reading a book "Linux Command Line and Shell Scripting Bible" and when I was studying about the concept on how to extract the value from the output and send it to a variable (which I completely understood) , Author calls this method "Command Substitution" .
After that there was this "Warning" section . In which the highlighted part I wasn't able to really understand .
I did refer this stackoverflow question over here > https://serverfault.com/questions/723391/subshell-is-not-created-if-run-commands-without-a-path
but I wasn't able to get it still .
If someone can please take out there time to help me understand this concept I would highly appreciate it thanks !
https://preview.redd.it/63sogx5i4unb1.png?width=985&format=png&auto=webp&s=298687b726f205cd7a9467a430bcdf3fa8e0aea8
https://redd.it/16gsxgm
@r_bash
Hi everyone ,
I'm currently reading a book "Linux Command Line and Shell Scripting Bible" and when I was studying about the concept on how to extract the value from the output and send it to a variable (which I completely understood) , Author calls this method "Command Substitution" .
After that there was this "Warning" section . In which the highlighted part I wasn't able to really understand .
I did refer this stackoverflow question over here > https://serverfault.com/questions/723391/subshell-is-not-created-if-run-commands-without-a-path
but I wasn't able to get it still .
If someone can please take out there time to help me understand this concept I would highly appreciate it thanks !
https://preview.redd.it/63sogx5i4unb1.png?width=985&format=png&auto=webp&s=298687b726f205cd7a9467a430bcdf3fa8e0aea8
https://redd.it/16gsxgm
@r_bash
Server Fault
subshell is not created if run commands without a path?
I'm reading the book "Linux Command Line and Shell Scripting Bible" 3rd edition. On page 279, here I quote:
"Command substitution creates what's called a subshell to run the
enclosed command. A
"Command substitution creates what's called a subshell to run the
enclosed command. A
What's this X$1 Thing?
I've run across "X$1" recently and I'm at a loss. Anyone have any ideas what it could be? If you could illustrate your explanation with a simple example, that would be fantastic, as I usually get things better this way.
https://redd.it/16gull2
@r_bash
I've run across "X$1" recently and I'm at a loss. Anyone have any ideas what it could be? If you could illustrate your explanation with a simple example, that would be fantastic, as I usually get things better this way.
https://redd.it/16gull2
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Pipelight - Tiny automation pipelines. -> v0.6.17
Hi! Some updates from the latest version of your friendly neighborhood automation tool.
You've always been able to increase pipeline log verbosity with the
But now you can also see what happens inside the software when running a pipeline with the internal verbosity flag (-u) .
more in the documentation at https://pipelight.dev
Pipelight is now compatible with every linux distros.
https://redd.it/16gsufa
@r_bash
Hi! Some updates from the latest version of your friendly neighborhood automation tool.
You've always been able to increase pipeline log verbosity with the
-v flag. But now you can also see what happens inside the software when running a pipeline with the internal verbosity flag (-u) .
pipelight run --attach -uuuu
more in the documentation at https://pipelight.dev
Pipelight is now compatible with every linux distros.
https://redd.it/16gsufa
@r_bash
Pipelight
Automation pipelines but easier.
Help with Syntax
Hello, I was wondering if anyone can spot any glaring issues with my syntax here for this function. I am running into \[: missing \`\]' and \[: too many arguments errors.
​
push_dependencies(){
for env in ${environments}
do
while read line; do
if [ $line = "" ]; then
break
elif [[ $line != "DEPENDENCIES" && $($line | cut -b -4) != " " ]] && [ $line != *"sircon"* ]; then
berks upload $(echo $line | xargs) --except test --force --config ~/.berkshelf/config-${env}.json
fi
done < Berksfile.lock
done
}
​
https://redd.it/16gxrl4
@r_bash
Hello, I was wondering if anyone can spot any glaring issues with my syntax here for this function. I am running into \[: missing \`\]' and \[: too many arguments errors.
​
push_dependencies(){
for env in ${environments}
do
while read line; do
if [ $line = "" ]; then
break
elif [[ $line != "DEPENDENCIES" && $($line | cut -b -4) != " " ]] && [ $line != *"sircon"* ]; then
berks upload $(echo $line | xargs) --except test --force --config ~/.berkshelf/config-${env}.json
fi
done < Berksfile.lock
done
}
​
https://redd.it/16gxrl4
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Something You Have Done
Hey! I'm curious to know about some of the nifty bash noscripting you've done, especially related to automation or some challenges. No need for anything complex, just something simple that you're proud of. Mine was some facts gathering , like an agent type stuff.
https://redd.it/16gxabh
@r_bash
Hey! I'm curious to know about some of the nifty bash noscripting you've done, especially related to automation or some challenges. No need for anything complex, just something simple that you're proud of. Mine was some facts gathering , like an agent type stuff.
https://redd.it/16gxabh
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
processing exit 1 in next step
So I am trying to write bash that will check if software is installed and if not return 1
I am having issue getting exit 1 passed down for some reason
else
echo "The Software $software_package is not installed. Flagging for installation"
exit 1
fi
exit 1 is not being passed to this line :
if [[ $? -ne 0 \]\]; then
echo "noscript exited with 1"
exit 1
fi
What I
https://redd.it/16h55y5
@r_bash
So I am trying to write bash that will check if software is installed and if not return 1
I am having issue getting exit 1 passed down for some reason
else
echo "The Software $software_package is not installed. Flagging for installation"
exit 1
fi
exit 1 is not being passed to this line :
if [[ $? -ne 0 \]\]; then
echo "noscript exited with 1"
exit 1
fi
What I
https://redd.it/16h55y5
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Hoping For help spotting an error
Hey Guys i have a project i am working on for uni where we gotta answer a bunch questions around learning bash commands my issue is just with the submission cause my uni is stupid.
we have to convert our notebook to HTML which is easy to do but we are getting automatic 0 grades even if one error.
​
what is happening when i convert is cant write it in meaning there is an error somewhere but when i run each cell im getting no errors what should be i looking for or feel free to DM me i cna give you my notebook if need
https://redd.it/16hcdmv
@r_bash
Hey Guys i have a project i am working on for uni where we gotta answer a bunch questions around learning bash commands my issue is just with the submission cause my uni is stupid.
we have to convert our notebook to HTML which is easy to do but we are getting automatic 0 grades even if one error.
jupyter nbconvert --execute --allow-errors --to html​
what is happening when i convert is cant write it in meaning there is an error somewhere but when i run each cell im getting no errors what should be i looking for or feel free to DM me i cna give you my notebook if need
https://redd.it/16hcdmv
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Have xargs release the shell after gui app is launched
Hello,
I have this Alias
alias fzfg='fd --type f |fzf-tmux -p --height=75% --reverse | xargs -o gimp '
This Alias works as is but it does not release the shell until gimp is closed.
I would like gimp to launch and free up the terminal for other work. I have tried background the gimp with & but can't get the correct syntax.
Any help greatly appreciated.
Joe
https://redd.it/16hc75j
@r_bash
Hello,
I have this Alias
alias fzfg='fd --type f |fzf-tmux -p --height=75% --reverse | xargs -o gimp '
This Alias works as is but it does not release the shell until gimp is closed.
I would like gimp to launch and free up the terminal for other work. I have tried background the gimp with & but can't get the correct syntax.
Any help greatly appreciated.
Joe
https://redd.it/16hc75j
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Kickstart RHEL Redhat Enterprise Linux with bash noscripts
Does anyone use the Kickstart method to automate the build of their RHEL machines?
I've put together a process to create the kickstart ISO's using bash noscripts.
https://www.attuneautomation.com/Automate-Red-Hat-Enterprise-Linux-RHEL-Installation/
https://redd.it/16hei63
@r_bash
Does anyone use the Kickstart method to automate the build of their RHEL machines?
I've put together a process to create the kickstart ISO's using bash noscripts.
https://www.attuneautomation.com/Automate-Red-Hat-Enterprise-Linux-RHEL-Installation/
https://redd.it/16hei63
@r_bash
Attune Automation
Attune Automation Project: Kickstart RHEL Redhat Enterprise Linux
As the demands of modern digital infrastructure grow, the need for
efficient and standardised methods of operating system deployment
becomes increasingly important.
The Kickstart method is a powerful tool that allows system
administrators to automate…
efficient and standardised methods of operating system deployment
becomes increasingly important.
The Kickstart method is a powerful tool that allows system
administrators to automate…
Align columns altered by sed with each respective values
Hi guys, hope everybody is well, i have translated free -h output to portuguese using sed with the following code
free -h | grep -v ""Swap:"" | sed -e 's/Mem:/ /g; s/total/Total/g; s/used/Em Uso/g; s/free/Livre/g; s/shared/Compartilhada/g; s/buff\\/cache/Em Cache/g; s/available/Disponível/g' | sed 's/\^ *//g';
the duplicated double quotes are there because it is coming from a powershell noscript that ssh into a linux machine.
the output from the code is:
​
After first column the rest are unaligned
There is any way to align them all as Total?
Thanks in Advance!
PS: I can use awk print {$1...} because ssh does not recognized the variables.
PS2: list view formatting would be a better solution
https://redd.it/16hols3
@r_bash
Hi guys, hope everybody is well, i have translated free -h output to portuguese using sed with the following code
free -h | grep -v ""Swap:"" | sed -e 's/Mem:/ /g; s/total/Total/g; s/used/Em Uso/g; s/free/Livre/g; s/shared/Compartilhada/g; s/buff\\/cache/Em Cache/g; s/available/Disponível/g' | sed 's/\^ *//g';
the duplicated double quotes are there because it is coming from a powershell noscript that ssh into a linux machine.
the output from the code is:
​
After first column the rest are unaligned
There is any way to align them all as Total?
Thanks in Advance!
PS: I can use awk print {$1...} because ssh does not recognized the variables.
PS2: list view formatting would be a better solution
https://redd.it/16hols3
@r_bash
Convert this noscript where I can input the day
LC_ALL=C awk -v beg=10:00:00 -v end=13:00:00 '
match($0, /[0-2][0-9]:[0-5][0-9]:[0-5][0-9]/) {
t = substr($0, RSTART, 8)
if (t >= end) selected = 0
else if (t >= beg) selected = 1
}
selected'
I didn't write this noscript but I vaguely understand it in gist and what it does..
The date format in our logs is like this (first and second column then rest are stuffs like INFO/DEBUG name of class bla bla...
2023-09-13 20:21:28
What I want
I want to be able to input the beginning day as well i.e I want logs of 2023-09-12 from 05:30:00 to 13:30:00.
How'd I do it?
I vaguely know it requires some regex and regex I bad at it.
https://redd.it/16hqgyh
@r_bash
LC_ALL=C awk -v beg=10:00:00 -v end=13:00:00 '
match($0, /[0-2][0-9]:[0-5][0-9]:[0-5][0-9]/) {
t = substr($0, RSTART, 8)
if (t >= end) selected = 0
else if (t >= beg) selected = 1
}
selected'
I didn't write this noscript but I vaguely understand it in gist and what it does..
The date format in our logs is like this (first and second column then rest are stuffs like INFO/DEBUG name of class bla bla...
2023-09-13 20:21:28
What I want
I want to be able to input the beginning day as well i.e I want logs of 2023-09-12 from 05:30:00 to 13:30:00.
How'd I do it?
I vaguely know it requires some regex and regex I bad at it.
https://redd.it/16hqgyh
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How to Make a GUI Prompt to Input Sudo Password?
Hi all! I was wondering i anyone had any ideas on how to create a pop-up to input the sudo password.
For right now, I'm just trying to do something as simple as make an executable noscript to run sudo apt update and apt upgrade, mainly just to try to get the prompt to work.
Tried using Zenity and ran a command to display "hi":
`echo $(zenity --password --noscript="Enter sudo password") | sudo -S echo "hi"`
Seems to work, but when i run it again, it prints the text again and completes the noscript and still brings up the prompt.
Also tried askpass, but when i try running `sudo -A apt update`, i get the message:
"sudo: no askpass program specified, try setting SUDO_ASKPASS"
When I run `echo $SUDO_ASKPASS`, it just displays a blank newline.
I'm not sure what to try next.
https://redd.it/16i1pey
@r_bash
Hi all! I was wondering i anyone had any ideas on how to create a pop-up to input the sudo password.
For right now, I'm just trying to do something as simple as make an executable noscript to run sudo apt update and apt upgrade, mainly just to try to get the prompt to work.
Tried using Zenity and ran a command to display "hi":
`echo $(zenity --password --noscript="Enter sudo password") | sudo -S echo "hi"`
Seems to work, but when i run it again, it prints the text again and completes the noscript and still brings up the prompt.
Also tried askpass, but when i try running `sudo -A apt update`, i get the message:
"sudo: no askpass program specified, try setting SUDO_ASKPASS"
When I run `echo $SUDO_ASKPASS`, it just displays a blank newline.
I'm not sure what to try next.
https://redd.it/16i1pey
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Bash Customization
Hey guys! Just started using bash. How have you guys customized your terminal and how have you gone about doing so? I added export PS1="$ " to my .bash_profile but that made me lose all colors that were previously in the text. Any help is appreciated! Just want to make it easier for me to read the terminal.
https://redd.it/16i5np9
@r_bash
Hey guys! Just started using bash. How have you guys customized your terminal and how have you gone about doing so? I added export PS1="$ " to my .bash_profile but that made me lose all colors that were previously in the text. Any help is appreciated! Just want to make it easier for me to read the terminal.
https://redd.it/16i5np9
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Shell noscript to enable or disable AVB/EAV mode possible?
Is it possible to enable or disable AVB/EAV mode by terminal?
https://preview.redd.it/wsso8y35x4ob1.png?width=684&format=png&auto=webp&s=c17e5a290a1494b92b0f764629ae5f16e55e09cc
https://redd.it/16i6qe3
@r_bash
Is it possible to enable or disable AVB/EAV mode by terminal?
https://preview.redd.it/wsso8y35x4ob1.png?width=684&format=png&auto=webp&s=c17e5a290a1494b92b0f764629ae5f16e55e09cc
https://redd.it/16i6qe3
@r_bash
How to conditionally remove names across parallel lines or immediately after each other?
How could every repeated actor but only if it repeats right into the next line - or multiple parallel lines (like DEVON and RICKEN here) there name gets deleted and replaced with spaces also empty line gets removed.
input:
RICKEN: This is so fun. Shall I, you know, tiptoe up and sneak to the door?
DEVON: He’s at work, baby. It doesn’t matter.
RICKEN: How do you know?
DEVON: Because his car’s not here.
RICKEN: Maybe he played hooky.
DEVON: Can you go do it?
DEVON: Cause I gotta pee.
DEVON: Realy fast.
RICKEN: Yes.
RICKEN: Against the door, or to the side?
DEVON: I think either’s really good.
RICKEN: Do you think he’ll be surprised?
DEVON: I do.
RICKEN: My babe, I’m gonna put it off to the side.
DEVON: Awesome.
output:
RICKEN: This is so fun. Shall I, you know, tiptoe up and sneak to the door?
DEVON: He’s at work, baby. It doesn’t matter.
RICKEN: How do you know?
DEVON: Because his car’s not here.
RICKEN: Maybe he played hooky.
DEVON: Can you go do it?
Cause I gotta pee.
Realy fast.
RICKEN: Yes.
Against the door, or to the side?
DEVON: I think either’s really good.
RICKEN: Do you think he’ll be surprised?
DEVON: I do.
RICKEN: My babe, I’m gonna put it off to the side.
DEVON: Awesome.
https://redd.it/16im5us
@r_bash
How could every repeated actor but only if it repeats right into the next line - or multiple parallel lines (like DEVON and RICKEN here) there name gets deleted and replaced with spaces also empty line gets removed.
input:
RICKEN: This is so fun. Shall I, you know, tiptoe up and sneak to the door?
DEVON: He’s at work, baby. It doesn’t matter.
RICKEN: How do you know?
DEVON: Because his car’s not here.
RICKEN: Maybe he played hooky.
DEVON: Can you go do it?
DEVON: Cause I gotta pee.
DEVON: Realy fast.
RICKEN: Yes.
RICKEN: Against the door, or to the side?
DEVON: I think either’s really good.
RICKEN: Do you think he’ll be surprised?
DEVON: I do.
RICKEN: My babe, I’m gonna put it off to the side.
DEVON: Awesome.
output:
RICKEN: This is so fun. Shall I, you know, tiptoe up and sneak to the door?
DEVON: He’s at work, baby. It doesn’t matter.
RICKEN: How do you know?
DEVON: Because his car’s not here.
RICKEN: Maybe he played hooky.
DEVON: Can you go do it?
Cause I gotta pee.
Realy fast.
RICKEN: Yes.
Against the door, or to the side?
DEVON: I think either’s really good.
RICKEN: Do you think he’ll be surprised?
DEVON: I do.
RICKEN: My babe, I’m gonna put it off to the side.
DEVON: Awesome.
https://redd.it/16im5us
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Accidentally broke something in a loop, noscript now complex enough to give me a headache
Not posting noscript directly here due to hugeness.
Pastebin: https://pastebin.com/WUUczzuD
Basically, I have this function "playlistscreenprinter".
It's intended job is to read a bunch of arrays, then print out the last n items in each array as columns in a numbered table. (n would be the number of rows in the terminal who aren't used for anything yet. It checks term size)
If the number of items in the array is less than n, then it should print what there is, and then some "echo -e" to pad out the end.
I had everything working until I started adding the conditional checks for if there is less in the array than n. Now it is broken, it prints out blank values instead.
Worse, this function has gotten complex enough that I actually can't hold all of it's workings inside my own head. I have literally no idea how these checks work, even though I have just written them. I get a headache and can't concentrate. (this might also have a medical component, but mostly interested in keeping to the noscript)
Could someone please check this code and tell me what it's actually doing? I feel like I've got a head wound.
https://redd.it/16ilw3b
@r_bash
Not posting noscript directly here due to hugeness.
Pastebin: https://pastebin.com/WUUczzuD
Basically, I have this function "playlistscreenprinter".
It's intended job is to read a bunch of arrays, then print out the last n items in each array as columns in a numbered table. (n would be the number of rows in the terminal who aren't used for anything yet. It checks term size)
If the number of items in the array is less than n, then it should print what there is, and then some "echo -e" to pad out the end.
I had everything working until I started adding the conditional checks for if there is less in the array than n. Now it is broken, it prints out blank values instead.
Worse, this function has gotten complex enough that I actually can't hold all of it's workings inside my own head. I have literally no idea how these checks work, even though I have just written them. I get a headache and can't concentrate. (this might also have a medical component, but mostly interested in keeping to the noscript)
Could someone please check this code and tell me what it's actually doing? I feel like I've got a head wound.
https://redd.it/16ilw3b
@r_bash
Pastebin
# playlist builder################################################## reusa - 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.