Store multi-line output into an array in a Linux bash script
In a Linux bash script, how would I store each line of output from a command into individual elements in an array? Thanks in advance...
|
My answer to your (fairly pointless, IMO ;)) poll is "could be better". I believe I understand basically what you want, but it needs more detail to make it really clear. What kind of "command" output are you talking about? Is it something simple like "find", or is it the output of a complex scripting function? Explaining exactly what you're trying to do is the most direct way to get help.
In any case, whether the input is space-separated or line-separated shouldn't matter generally, because the IFS defaults to both. I'm not an expert on arrays, but if, for example, you want to input the files in the current directory, you could do something like this: Code:
find . Code:
N=0 |
Hello Steven :)
Code:
#! /bin/bash Charles |
Sorry - I was not sure what the poll was - please disregard. And thanks for the replies on my post - I incorporated in my script with no problems.
|
How about storing user input into an array?
Code:
echo "Please enter some info (separated by spaces for example) Thank YOu |
vbekker, best start a new thread for your question :)
|
All times are GMT -5. The time now is 08:27 AM. |