Turn lines in file into list of input [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash 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







share|improve this 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.


















    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







    share|improve this 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.
















      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







      share|improve this question












      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









      share|improve this question










      share|improve this question




      share|improve this question









      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.






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Almost there.



          tool "$list[@]" output





          share|improve this answer





















          • This is awesome! Thank you. I will mark as answer when the timer is done :)
            – Xitrum
            May 9 at 11:34

















          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





          share|improve this answer





















          • This is awesome! Thank you. I will mark as answer when the timer is done :)
            – Xitrum
            May 9 at 11:34














          up vote
          2
          down vote



          accepted










          Almost there.



          tool "$list[@]" output





          share|improve this answer





















          • This is awesome! Thank you. I will mark as answer when the timer is done :)
            – Xitrum
            May 9 at 11:34












          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          Almost there.



          tool "$list[@]" output





          share|improve this answer













          Almost there.



          tool "$list[@]" output






          share|improve this answer













          share|improve this answer



          share|improve this answer











          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
















          • 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


          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay