Turn lines in file into list of input [duplicate]
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
This question already has an answer here:
Passing arguments from a file to a bash script
3 answers
The command i want to execute:
tool <input> [<input> ...] <output>
I have the input list in a file, separated by newline.
I want to put that file's content into the input field. What I have tried:
First I load the file into an array:
# Load file into array.
declare -a list
let i=0
while IFS=$'n' read -r line_data; do
list[i]="$line_data"
((++i))
done < file.txt
Then I tried using that array in the command as:
tool $list output
But it doesn't work as I expected. Can someone help me on this?
Thank you very much
bash arguments
marked as duplicate by don_crissti, Community⦠May 9 at 11:34
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
0
down vote
favorite
This question already has an answer here:
Passing arguments from a file to a bash script
3 answers
The command i want to execute:
tool <input> [<input> ...] <output>
I have the input list in a file, separated by newline.
I want to put that file's content into the input field. What I have tried:
First I load the file into an array:
# Load file into array.
declare -a list
let i=0
while IFS=$'n' read -r line_data; do
list[i]="$line_data"
((++i))
done < file.txt
Then I tried using that array in the command as:
tool $list output
But it doesn't work as I expected. Can someone help me on this?
Thank you very much
bash arguments
marked as duplicate by don_crissti, Community⦠May 9 at 11:34
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
Passing arguments from a file to a bash script
3 answers
The command i want to execute:
tool <input> [<input> ...] <output>
I have the input list in a file, separated by newline.
I want to put that file's content into the input field. What I have tried:
First I load the file into an array:
# Load file into array.
declare -a list
let i=0
while IFS=$'n' read -r line_data; do
list[i]="$line_data"
((++i))
done < file.txt
Then I tried using that array in the command as:
tool $list output
But it doesn't work as I expected. Can someone help me on this?
Thank you very much
bash arguments
This question already has an answer here:
Passing arguments from a file to a bash script
3 answers
The command i want to execute:
tool <input> [<input> ...] <output>
I have the input list in a file, separated by newline.
I want to put that file's content into the input field. What I have tried:
First I load the file into an array:
# Load file into array.
declare -a list
let i=0
while IFS=$'n' read -r line_data; do
list[i]="$line_data"
((++i))
done < file.txt
Then I tried using that array in the command as:
tool $list output
But it doesn't work as I expected. Can someone help me on this?
Thank you very much
This question already has an answer here:
Passing arguments from a file to a bash script
3 answers
bash arguments
asked May 9 at 11:27
Xitrum
1033
1033
marked as duplicate by don_crissti, Community⦠May 9 at 11:34
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by don_crissti, Community⦠May 9 at 11:34
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Almost there.
tool "$list[@]" output
This is awesome! Thank you. I will mark as answer when the timer is done :)
â Xitrum
May 9 at 11:34
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Almost there.
tool "$list[@]" output
This is awesome! Thank you. I will mark as answer when the timer is done :)
â Xitrum
May 9 at 11:34
add a comment |Â
up vote
2
down vote
accepted
Almost there.
tool "$list[@]" output
This is awesome! Thank you. I will mark as answer when the timer is done :)
â Xitrum
May 9 at 11:34
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Almost there.
tool "$list[@]" output
Almost there.
tool "$list[@]" output
answered May 9 at 11:31
Ignacio Vazquez-Abrams
32k66780
32k66780
This is awesome! Thank you. I will mark as answer when the timer is done :)
â Xitrum
May 9 at 11:34
add a comment |Â
This is awesome! Thank you. I will mark as answer when the timer is done :)
â Xitrum
May 9 at 11:34
This is awesome! Thank you. I will mark as answer when the timer is done :)
â Xitrum
May 9 at 11:34
This is awesome! Thank you. I will mark as answer when the timer is done :)
â Xitrum
May 9 at 11:34
add a comment |Â