You know when you do something like
apt-cache search something | less? Well (in a Bash script) how do you get the input and set it to a variable (like
less is doing, but
less isn't a Bash script)?
If you want to do something like what
Then you can run it like this:
and your output will look like this:
or by appending elements on the end of an array:
You are misunderstanding
To assign the output of one command to a variable, you would normally do something like this:
But I very much doubt you really want to assign the output of
Can you elaborate a bit on your larger goal? What are you really trying to do?