How to combine dowloading files and compressing them simultaneously?
The software fasterq-dump doesn't offer zipping fastq/sra files. How can I add bgzip/gzip for a long list of paired end sequencing files (the files are split into something like SRR*****_1.fastq and SRR*****_2.fastq) without having to compress them after the download is done?
I wrote a line of code to download files using
or
https://redd.it/17bjobh
@r_bash
The software fasterq-dump doesn't offer zipping fastq/sra files. How can I add bgzip/gzip for a long list of paired end sequencing files (the files are split into something like SRR*****_1.fastq and SRR*****_2.fastq) without having to compress them after the download is done?
I wrote a line of code to download files using
parallel as well as a for loop but not sure how the gzip/bgzip would work and where to use it for file compression:cat $SRR_LIST | parallel --verbose fasterq-dump -p -v --split-files --qual-defline '+' {} --outdir "$dir/ChIP-Seq/"or
for SRR in ${SRR_LIST}doecho Downloading ${SRR}...#time fasterq-dump -p -v --split-files --qual-defline '+' ${SRR} --outdir "$dir/ChIP-Seq/"echo Done ${SRR}.donehttps://redd.it/17bjobh
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Enjoy with Best Service IPTV Provider in The world 2023
**http://etsy-tv.store**
"Say goodbye to expensive cable bills and hello to unlimited entertainment with our TV service. Get access to over +19.000 channels from around the world at a fraction of the cost."
"Cut the cord and join the TV revolution. Our service offers the best in live TV streaming, with crystal-clear picture quality and reliable service. Sign up now to start enjoying your favorite shows, sports, and movies."
"Why settle for limited cable options when you can have it all with TV? Our service delivers premium channels from all over the world, including sports, movies, and TV shows. Plus, with our easy-to-use interface, you'll never miss a beat."
"Looking for a better way to watch TV? Look no further than our TV service. With our extensive channel lineup, including international options, you'll have access to all your favorites. Say goodbye to cable and hello to the future of television."
I know that this group is not dedicated to T.V services, but I just want to present my service to those who are interested. Due to that, I have received negative karma on my account.
https://redd.it/17bkhhc
@r_bash
**http://etsy-tv.store**
"Say goodbye to expensive cable bills and hello to unlimited entertainment with our TV service. Get access to over +19.000 channels from around the world at a fraction of the cost."
"Cut the cord and join the TV revolution. Our service offers the best in live TV streaming, with crystal-clear picture quality and reliable service. Sign up now to start enjoying your favorite shows, sports, and movies."
"Why settle for limited cable options when you can have it all with TV? Our service delivers premium channels from all over the world, including sports, movies, and TV shows. Plus, with our easy-to-use interface, you'll never miss a beat."
"Looking for a better way to watch TV? Look no further than our TV service. With our extensive channel lineup, including international options, you'll have access to all your favorites. Say goodbye to cable and hello to the future of television."
I know that this group is not dedicated to T.V services, but I just want to present my service to those who are interested. Due to that, I have received negative karma on my account.
https://redd.it/17bkhhc
@r_bash
Etsy IPTV
Home
Etsy IPTV: A world of entertainment with over 19,700 Live TV Channels, 89,000+ Movies, and top-quality service. Join us and enjoy streaming like never before.
Router noscript?
I own an asus gtax11000 pro router and it's possible to tell it to reboot at night. However this isn't always a good thing if i am downloading or busy transferring files across the network at the time.
Is it possible to write a noscript and execute it on the router that would detect if there was any wan and/or lan activity in the past 10 minutes and if not then send a command to restart the router?
https://redd.it/17cc28f
@r_bash
I own an asus gtax11000 pro router and it's possible to tell it to reboot at night. However this isn't always a good thing if i am downloading or busy transferring files across the network at the time.
Is it possible to write a noscript and execute it on the router that would detect if there was any wan and/or lan activity in the past 10 minutes and if not then send a command to restart the router?
https://redd.it/17cc28f
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Saving variables to file
Ok so say I did this
Echo “this variable will be saved”
Read variable
How do I save that variable to a text file,what would be the syntax for it? Thanks
https://redd.it/17cbsbp
@r_bash
Ok so say I did this
Echo “this variable will be saved”
Read variable
How do I save that variable to a text file,what would be the syntax for it? Thanks
https://redd.it/17cbsbp
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Upload files to ix.io
I wrote a small wrapper noscript for ix.io to make it more convenient to use from the terminal. It can also be used within vim with !! cmd 😉
Script: https://github.com/SimonWoodtli/dotfiles/blob/main/noscripts/ix
Demo: https://github-production-user-asset-6210df.s3.amazonaws.com/66033447/276981265-7d80fe6e-cce9-4ac2-a4c1-6f5729bf27ac.webm
https://redd.it/17cegsm
@r_bash
I wrote a small wrapper noscript for ix.io to make it more convenient to use from the terminal. It can also be used within vim with !! cmd 😉
Script: https://github.com/SimonWoodtli/dotfiles/blob/main/noscripts/ix
Demo: https://github-production-user-asset-6210df.s3.amazonaws.com/66033447/276981265-7d80fe6e-cce9-4ac2-a4c1-6f5729bf27ac.webm
https://redd.it/17cegsm
@r_bash
GitHub
dotfiles/noscripts/ix at main · SimonWoodtli/dotfiles
🏡 My personal dotfiles. Contribute to SimonWoodtli/dotfiles development by creating an account on GitHub.
Backend Question Is dup2 how a UNIX shell, like Bash, does things like
So I wanna know how a shell like Bash does this:
All I can guess is, it first opens file denoscriptor 3, just by calling
Thanks for your help.
Edit: I did strace, there was not a SINGLE
https://redd.it/17ckjh6
@r_bash
cat /dev/fd/5 5<<< foo?So I wanna know how a shell like Bash does this:
cat /dev/fd/5 5<<< "foo"
All I can guess is, it first opens file denoscriptor 3, just by calling
open(2), then duplicates it to fd 5 using dup2(2) as in: dup2(fd, 5). Is that how it does this?Thanks for your help.
Edit: I did strace, there was not a SINGLE
5 in there!https://redd.it/17ckjh6
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
listing files in correct numeric order?
I have a directory that has files named like this:
S01E001.mp4
S01E002.mp4
S01E003.mp4
S01E004.mp4
S01E005.mp4
S01E006.mp4
S01E007.mp4
S01E008.mp4
S01E009.mp4
S01E010.mp4
S01E011.mp4
S01E012.mp4
S01E013.mp4
However, ls gives this output:
S01E010.mp4
S01E011.mp4
S01E001.mp4
S01E002.mp4
S01E003.mp4
S01E004.mp4
S01E005.mp4
S01E006.mp4
S01E007.mp4
S01E008.mp4
S01E009.mp4
S01E012.mp4
S01E013.mp4
Why does this occur?
https://redd.it/17cnflj
@r_bash
I have a directory that has files named like this:
S01E001.mp4
S01E002.mp4
S01E003.mp4
S01E004.mp4
S01E005.mp4
S01E006.mp4
S01E007.mp4
S01E008.mp4
S01E009.mp4
S01E010.mp4
S01E011.mp4
S01E012.mp4
S01E013.mp4
However, ls gives this output:
S01E010.mp4
S01E011.mp4
S01E001.mp4
S01E002.mp4
S01E003.mp4
S01E004.mp4
S01E005.mp4
S01E006.mp4
S01E007.mp4
S01E008.mp4
S01E009.mp4
S01E012.mp4
S01E013.mp4
Why does this occur?
https://redd.it/17cnflj
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How to define parameters in a function in BASH?
Hello, I'm trying to write a Knight's Tour resolutor noscript in BASH but I need to apply recursion and don't know how without function parameters. For example, I want to use two functions, one that resolves the algorithm (knight_tour)) and a "main". I want to use recursion inside the knight_tour() function but I don't know how without parameters. I'm very new to BASH so I know it's atrocious. Thank you even for just reading!
​
​
https://redd.it/17cpidl
@r_bash
Hello, I'm trying to write a Knight's Tour resolutor noscript in BASH but I need to apply recursion and don't know how without function parameters. For example, I want to use two functions, one that resolves the algorithm (knight_tour)) and a "main". I want to use recursion inside the knight_tour() function but I don't know how without parameters. I'm very new to BASH so I know it's atrocious. Thank you even for just reading!
for i in {1..8}doprossimo_x=$((x+cavallo_movimento_x[i]));prossimo_y=$((y+cavallo_movimento_y[i]));scacchiera[prossimo_x, prossimo_y]=num_mossa;​
knight_tour $prossimo_x $prossimo_y $((num_mossa+1)) $scacchiera $cavallo_movimento_x $cavallo_movimento_y​
https://redd.it/17cpidl
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Function Arguments/Recursion
Hi, I'm pretty new in bash. I have a question, can you implement recursion in a function? For example:
You have a function fun1(). Can you "manually add" arguments or you have to do some work-arounds? Can you do something like calling fun1(int a, int b, int c) inside fun1? I'm trying to implement Knight's Tour in Bash but it's so damn hard in Bash (school stuff, I can't use C) Thank you!
https://redd.it/17cq92s
@r_bash
Hi, I'm pretty new in bash. I have a question, can you implement recursion in a function? For example:
You have a function fun1(). Can you "manually add" arguments or you have to do some work-arounds? Can you do something like calling fun1(int a, int b, int c) inside fun1? I'm trying to implement Knight's Tour in Bash but it's so damn hard in Bash (school stuff, I can't use C) Thank you!
https://redd.it/17cq92s
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
make: Error 1
I am trying to make the build folder with command "make" but keep getting Error 1:
make: \** [Makefile:54: build/server_multi.o\] Error 1
​
Here is a glimpse of my Makefile:
​
TARGETS = server_lim
LIBS = timelib
LDFLAGS = -lm -lpthread
BUILDDIR = build
BUILD_TARGETS = $(addprefix $(BUILDDIR)/,$(TARGETS))
OBJS = $(addprefix $(BUILDDIR)/,$(addsuffix .o,$(TARGETS) $(LIBS)))
LIBOBJS = $(addprefix $(BUILDDIR)/,$(addsuffix .o,$(LIBS)))
​
all: $(BUILD_TARGETS)
​
$(BUILD_TARGETS): $(BUILDDIR) $(OBJS)
gcc -o $@ $@.o $(LIBOBJS) $(LDFLAGS) -W -Wall
​
$(BUILDDIR):
mkdir $(BUILDDIR)
​
$(BUILDDIR)/%.o: %.c
gcc -o $@ -c $< -W -Wall
​
clean:
rm *\~ -rf $(BUILDDIR)
How can I fix this error?
https://redd.it/17cvfju
@r_bash
I am trying to make the build folder with command "make" but keep getting Error 1:
make: \** [Makefile:54: build/server_multi.o\] Error 1
​
Here is a glimpse of my Makefile:
​
TARGETS = server_lim
LIBS = timelib
LDFLAGS = -lm -lpthread
BUILDDIR = build
BUILD_TARGETS = $(addprefix $(BUILDDIR)/,$(TARGETS))
OBJS = $(addprefix $(BUILDDIR)/,$(addsuffix .o,$(TARGETS) $(LIBS)))
LIBOBJS = $(addprefix $(BUILDDIR)/,$(addsuffix .o,$(LIBS)))
​
all: $(BUILD_TARGETS)
​
$(BUILD_TARGETS): $(BUILDDIR) $(OBJS)
gcc -o $@ $@.o $(LIBOBJS) $(LDFLAGS) -W -Wall
​
$(BUILDDIR):
mkdir $(BUILDDIR)
​
$(BUILDDIR)/%.o: %.c
gcc -o $@ -c $< -W -Wall
​
clean:
rm *\~ -rf $(BUILDDIR)
How can I fix this error?
https://redd.it/17cvfju
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Help me increase the variable in array
I have my input parameters split using delimeter "=" and placed into array. How can I make this "1" variable into "2" on the next iteration of my loop.
While "$param" -le $#
do
arrPARAM=(${1//=/ })
arrPARAM=($(2//=/ }) should be what it looks like on the next iteration
arrPARAM=(${$count//=/ }) doesnt work, count=1 then plus 1 every iteration
https://redd.it/17cylmc
@r_bash
I have my input parameters split using delimeter "=" and placed into array. How can I make this "1" variable into "2" on the next iteration of my loop.
While "$param" -le $#
do
arrPARAM=(${1//=/ })
arrPARAM=($(2//=/ }) should be what it looks like on the next iteration
arrPARAM=(${$count//=/ }) doesnt work, count=1 then plus 1 every iteration
https://redd.it/17cylmc
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Simple noob question
I have a long-running command running in an ssh shell (ubuntu). I have another command ready to execute afterwards, eg.
If I ctrl-z the long-running command (eg. sleep), it will of course then execute echo. How can I ctrl-z,
As you may have guessed, the second command is a notification so I know when the first has finished :D
I've found this SU post: https://superuser.com/q/361790, but it doesn't seem to have any useful info on how to do this.
Any points in the right direction would be very appreciated; I'm sure there's an easy way to do this without restarting my long-running command to put it in a noscript.
​
edit: change markdown to rich text
https://redd.it/17d5eva
@r_bash
I have a long-running command running in an ssh shell (ubuntu). I have another command ready to execute afterwards, eg.
sleep 30\n echo 1 or sleep 30; echo 1.If I ctrl-z the long-running command (eg. sleep), it will of course then execute echo. How can I ctrl-z,
bg, and disown both lines such that I can log out of my ssh session without interrupting the process, and still run the second command once the first has finished?As you may have guessed, the second command is a notification so I know when the first has finished :D
I've found this SU post: https://superuser.com/q/361790, but it doesn't seem to have any useful info on how to do this.
Any points in the right direction would be very appreciated; I'm sure there's an easy way to do this without restarting my long-running command to put it in a noscript.
​
edit: change markdown to rich text
https://redd.it/17d5eva
@r_bash
Super User
Ctrl+Z and fg to append commands
I would like to know what is the behaviour of Ctrl+Z and fg in bash when wanting to append commands to be executed after a running command has finished. For example, in the sequence for commands be...
How to replace tab with space in file only for tabs before letters, not numbers?
I have a file with contents of
X Y Z m
A B n
...
where X, Y, Z and A, B are words and m, n are numbers. They are in a tsv file, so all separated by tabs.
How can I substitute the tabs between the words X, Y, Z and A, B with spaces while keeping the tabs before the numbers m, n intact?
I thought about this (some regex?) but cannot think of a good solution.
EDIT: m,n can be larger than 9, so not necessarily single digits.
https://redd.it/17e204g
@r_bash
I have a file with contents of
X Y Z m
A B n
...
where X, Y, Z and A, B are words and m, n are numbers. They are in a tsv file, so all separated by tabs.
How can I substitute the tabs between the words X, Y, Z and A, B with spaces while keeping the tabs before the numbers m, n intact?
I thought about this (some regex?) but cannot think of a good solution.
EDIT: m,n can be larger than 9, so not necessarily single digits.
https://redd.it/17e204g
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Help with noscript to detect if my webcam is currently active
I’m trying to create a shell noscript to run on a schedule. I just want a simple yes/no, on/off, or any kind of Boolean to determine if the camera is in use so I can then run other automations.
Seems this is possible using ps or grep but I haven’t been able to figure it out.
https://redd.it/17e4gbn
@r_bash
I’m trying to create a shell noscript to run on a schedule. I just want a simple yes/no, on/off, or any kind of Boolean to determine if the camera is in use so I can then run other automations.
Seems this is possible using ps or grep but I haven’t been able to figure it out.
https://redd.it/17e4gbn
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
What situations call for a subshell?
As I'm following a tutorial on Bash, the topic on subshells has me stumped. For example, the tutorial makes use of a subshell in order to access a database. That leaves me to ask:
When should a subshell be used when running a noscript?
How important are they and what are the consequences of not using them?
https://redd.it/17ed5dy
@r_bash
As I'm following a tutorial on Bash, the topic on subshells has me stumped. For example, the tutorial makes use of a subshell in order to access a database. That leaves me to ask:
When should a subshell be used when running a noscript?
How important are they and what are the consequences of not using them?
https://redd.it/17ed5dy
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Hopefully an easy question, though I doubt it
So, I've been re-learning bash noscripting over the past year, and I'm getting fairly proficient again, like being able to write some types of noscripts without having to look most things up anymore, but I've been working on a a couple of noscripts, one of which isn't my own, but I'm kind of modifying the living bejeezus out of it. It's a basic ls alternative called 'formatdir' that was an example in "Wicked Cool Shell Scripts", and I transcribed it to my WSL environment when I started re-learning bash. I'm now working on adding filetype recognition, and several things are easy as pie to get working, like directories, noscripts, pipes, stuff that has a dedicated file test option.
But now I'm starting to get into the weeds, and I'm kinda up to my waist in the river as it were, with trying to figure out like archives for the moment. Is there a way to test whether a file is an archive? Doesn't have to like recognize whether it's a zip or a tarball, I just need to have the noscript identify that "this file is an archive" so I can have it give the output for them the proper color.
https://redd.it/17effgd
@r_bash
So, I've been re-learning bash noscripting over the past year, and I'm getting fairly proficient again, like being able to write some types of noscripts without having to look most things up anymore, but I've been working on a a couple of noscripts, one of which isn't my own, but I'm kind of modifying the living bejeezus out of it. It's a basic ls alternative called 'formatdir' that was an example in "Wicked Cool Shell Scripts", and I transcribed it to my WSL environment when I started re-learning bash. I'm now working on adding filetype recognition, and several things are easy as pie to get working, like directories, noscripts, pipes, stuff that has a dedicated file test option.
But now I'm starting to get into the weeds, and I'm kinda up to my waist in the river as it were, with trying to figure out like archives for the moment. Is there a way to test whether a file is an archive? Doesn't have to like recognize whether it's a zip or a tarball, I just need to have the noscript identify that "this file is an archive" so I can have it give the output for them the proper color.
https://redd.it/17effgd
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Administration tools for Linux (Bash)
Here are a few Bash noscripts for Linux system administration, I am working to release a few more security oriented noscripts. I would appreciate if you could take a look at them and give me feedback. Thank you very much!
https://github.com/javisys/System-Administration-Scripts-Linux
https://redd.it/17ejbrj
@r_bash
Here are a few Bash noscripts for Linux system administration, I am working to release a few more security oriented noscripts. I would appreciate if you could take a look at them and give me feedback. Thank you very much!
https://github.com/javisys/System-Administration-Scripts-Linux
https://redd.it/17ejbrj
@r_bash
GitHub
GitHub - javisys/System-Administration-Scripts-Linux: Simple noscripts for system administration for Linux, later I will create another…
Simple noscripts for system administration for Linux, later I will create another one with Powershell also for Active Directory. - GitHub - javisys/System-Administration-Scripts-Linux: Simple noscript...
How to develop apps for within shell?
I mean something like terminal train. Which language is used? Can you link me to a github repo for something similar?
https://redd.it/17enawo
@r_bash
I mean something like terminal train. Which language is used? Can you link me to a github repo for something similar?
https://redd.it/17enawo
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Command fails in noscript, but succeeds from SSH terminal window. WTH?!
I'm baffled. I have this folder called Documents and it has a directory called, `Dir with (parentheis) and apostrophe's and [square brackets]`. I created this very basic noscript to demonstrate the behavior I am seeing and seek help. Here is the code:
# !/bin/sh
dirname=/share/Documents
IFS=$'\n';
for d in $dirname**/Dir*; do echo ls "\"$d\"" 2>&1; ls "\"$d\"" 2>&1; break; done
When I run the noscript, I am getting the following:
# ~/dateadded.sh
ls "/share/Documents/Dir with (parentheis) and apostrophe's and [square brackets]"
ls: cannot access "/share/Documents/Dir with (parentheis) and apostrophe's and [square brackets]": No such file or directory
When I copy&paste the first line of output from the noscript into the same terminal window's prompt from which the noscript is run, I get this as a result:
# ls "/share/Documents/Dir with (parentheis) and apostrophe's and [square brackets]"
total 20
4 drwxrwxr-x 2 admin administrators 4096 Oct 23 18:33 .
16 drwxrwxrwx 89 tntadmin administrators 12288 Oct 23 18:33 ..
That's what I am expecting from the noscript.
This server is a QNap NAS and I am running the noscript locally via a SSH terminal. I have tried running this with bash and sh. I have run `set` from the Terminal and from within the noscript and piped the output to files and put the differences into the noscript and (aside from the errors about read-only variables) still get the error. Enclosing the directory name in quotes should be sufficient but I even tried piping the directory name to `sed` to escape all the special characters. Still no love. I tried busybox and coreutils `ls` and `bash`. Nothing is working. I even tried running from Docker Containers running Ubuntu and Debian. STILL NO LOVE!
EDIT: I just tried changing the subdirectory of `$dirname` to a directory called `Scanned` that has absolutely no special characters at all. STILL NO LOVE!!!!!
Help?!
https://redd.it/17eyhzn
@r_bash
I'm baffled. I have this folder called Documents and it has a directory called, `Dir with (parentheis) and apostrophe's and [square brackets]`. I created this very basic noscript to demonstrate the behavior I am seeing and seek help. Here is the code:
# !/bin/sh
dirname=/share/Documents
IFS=$'\n';
for d in $dirname**/Dir*; do echo ls "\"$d\"" 2>&1; ls "\"$d\"" 2>&1; break; done
When I run the noscript, I am getting the following:
# ~/dateadded.sh
ls "/share/Documents/Dir with (parentheis) and apostrophe's and [square brackets]"
ls: cannot access "/share/Documents/Dir with (parentheis) and apostrophe's and [square brackets]": No such file or directory
When I copy&paste the first line of output from the noscript into the same terminal window's prompt from which the noscript is run, I get this as a result:
# ls "/share/Documents/Dir with (parentheis) and apostrophe's and [square brackets]"
total 20
4 drwxrwxr-x 2 admin administrators 4096 Oct 23 18:33 .
16 drwxrwxrwx 89 tntadmin administrators 12288 Oct 23 18:33 ..
That's what I am expecting from the noscript.
This server is a QNap NAS and I am running the noscript locally via a SSH terminal. I have tried running this with bash and sh. I have run `set` from the Terminal and from within the noscript and piped the output to files and put the differences into the noscript and (aside from the errors about read-only variables) still get the error. Enclosing the directory name in quotes should be sufficient but I even tried piping the directory name to `sed` to escape all the special characters. Still no love. I tried busybox and coreutils `ls` and `bash`. Nothing is working. I even tried running from Docker Containers running Ubuntu and Debian. STILL NO LOVE!
EDIT: I just tried changing the subdirectory of `$dirname` to a directory called `Scanned` that has absolutely no special characters at all. STILL NO LOVE!!!!!
Help?!
https://redd.it/17eyhzn
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
What's the difference between running `unset array_var` and `unset array_var[*]` given array_var is an array variable?
`array_var` is an array variable.
**First step:**
I unset `array_var` by running this command: `unset array_var[*]`. After that I ran this command: `set | grep array_var` and this was the output:
_=array_var
**Second step:**
I unset `array_var` by running this command: `unset array_var`. And again, I run this command: `set | grep array_var` and I see the same output:
_=array_var
My CLI looks this now:
user@apple:~$ set | grep array_var
user@apple:~$ array_var=(one two three four five)
user@apple:~$ unset array_var[*]
user@apple:~$ set | grep array_var
_=array_var
user@apple:~$ array_var=(one two three four five)
user@apple:~$ unset array_var
user@apple:~$ set | grep array_var
_=array_var
user@apple:~$
So does that mean `unset array_var[*]` and `unset array_var` commands have the same purpose. I am not actually sure about this tho.
Also what does `_=array_var` mean?
Also another important thing I noticed is that, if we follow the steps in a reverse order (second step -> first step) `_=array_var` is not output when `set | grep array_var` is run. So that means `_=array_var` was created only when running `unset array_var[*]`. It will be nice if someone explained this too.
Thanks.
https://redd.it/17fa9w8
@r_bash
`array_var` is an array variable.
**First step:**
I unset `array_var` by running this command: `unset array_var[*]`. After that I ran this command: `set | grep array_var` and this was the output:
_=array_var
**Second step:**
I unset `array_var` by running this command: `unset array_var`. And again, I run this command: `set | grep array_var` and I see the same output:
_=array_var
My CLI looks this now:
user@apple:~$ set | grep array_var
user@apple:~$ array_var=(one two three four five)
user@apple:~$ unset array_var[*]
user@apple:~$ set | grep array_var
_=array_var
user@apple:~$ array_var=(one two three four five)
user@apple:~$ unset array_var
user@apple:~$ set | grep array_var
_=array_var
user@apple:~$
So does that mean `unset array_var[*]` and `unset array_var` commands have the same purpose. I am not actually sure about this tho.
Also what does `_=array_var` mean?
Also another important thing I noticed is that, if we follow the steps in a reverse order (second step -> first step) `_=array_var` is not output when `set | grep array_var` is run. So that means `_=array_var` was created only when running `unset array_var[*]`. It will be nice if someone explained this too.
Thanks.
https://redd.it/17fa9w8
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community