Read Text List into Dynamic array?gnuplot shell variable substitution and arraysCreate array in bash with...

How do I get a list of only the files (not the directories) from a package?

TV show or movie: Diseased people are exiled to a spaceship

Why were the Night's Watch required to be celibate?

The deliberate use of misleading terminology

Bringing Food from Hometown for Out-of-Town Interview?

Rotated Position of Integers

Why does the UK have more political parties than the US?

Why is Colorado so different politically from nearby states?

How did the Zip Chip and RocketChip accelerators work for the Apple II?

Does a component pouch automatically contain components?

What does it mean by "d-ism of Leibniz" and "dotage of Newton" in simple English?

Is having a hidden directory under /etc safe?

Explain Ant-Man's "not it" scene from Avengers: Endgame

Is it possible to kill all life on Earth?

Accidentally cashed a check twice

Is the capacitor drawn or wired wrongly?

What is a simple, physical situation where complex numbers emerge naturally?

If a problem only occurs randomly once in every N times on average, how many tests do I have to perform to be certain that it's now fixed?

Asking for something with different prices

Singlequote and backslash

If a massive object like Jupiter flew past the Earth how close would it need to come to pull people off of the surface?

What does War Machine's "Canopy! Canopy!" line mean in "Avengers: Endgame"?

Can an old DSLR be upgraded to match modern smartphone image quality

Can you please explain this joke: "I'm going bananas is what I tell my bananas before I leave the house"?



Read Text List into Dynamic array?


gnuplot shell variable substitution and arraysCreate array in bash with variables as array nameExtracting duplicity backup dataCount number of elements in bash array, where the name of the array is dynamic (i.e. stored in a variable)execute command on a defined range of directorieskeeping line number when processing text inside a grepCreate array in bash script out of mounted USB external drives on macOSSplit string of filenames into an arrayHistory inside a Bash LoopForce alphabetical order in for loop with if conditions






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















Trying to automate some work stuff and this includes many folder generations but and I was thinking of using a dynamic array to do this, let me know how this sounds.



First Part of my Script is to export a directory list using the:



ls /home/USER/Downloads/ > "/home/USER/Desktop/scripts/FolderList.txt"


and it gives the output as expected:



Folder With Some Long Title
Folder With Another Long Title


In this example I only gave (2) but there could be upwards of 1500+ folders and I have already written the commands to create the other folders on my server and name them automatically based off the original folder name, but the problem I have is I want my scripts to index thru all the folders and preform my commands (there are about 8 that are mostly string manipulations and such). So I was thinking of getting the count of the number of items in the Directory then write them to the text file mentioned above, then using a FOR-Loop to run that number of times that will contain my 8 or so commands? any thoughts or better ideas?
I Can get the count using:



wc -l FolderList.txt | awk '{ print $1 }'


But I'm not sure how to create or manage a Dynamic Array and use it with the for-loop to index thru my commands. any guidance appreciated thank you.










share|improve this question







New contributor



user354662 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


























    1















    Trying to automate some work stuff and this includes many folder generations but and I was thinking of using a dynamic array to do this, let me know how this sounds.



    First Part of my Script is to export a directory list using the:



    ls /home/USER/Downloads/ > "/home/USER/Desktop/scripts/FolderList.txt"


    and it gives the output as expected:



    Folder With Some Long Title
    Folder With Another Long Title


    In this example I only gave (2) but there could be upwards of 1500+ folders and I have already written the commands to create the other folders on my server and name them automatically based off the original folder name, but the problem I have is I want my scripts to index thru all the folders and preform my commands (there are about 8 that are mostly string manipulations and such). So I was thinking of getting the count of the number of items in the Directory then write them to the text file mentioned above, then using a FOR-Loop to run that number of times that will contain my 8 or so commands? any thoughts or better ideas?
    I Can get the count using:



    wc -l FolderList.txt | awk '{ print $1 }'


    But I'm not sure how to create or manage a Dynamic Array and use it with the for-loop to index thru my commands. any guidance appreciated thank you.










    share|improve this question







    New contributor



    user354662 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      1












      1








      1








      Trying to automate some work stuff and this includes many folder generations but and I was thinking of using a dynamic array to do this, let me know how this sounds.



      First Part of my Script is to export a directory list using the:



      ls /home/USER/Downloads/ > "/home/USER/Desktop/scripts/FolderList.txt"


      and it gives the output as expected:



      Folder With Some Long Title
      Folder With Another Long Title


      In this example I only gave (2) but there could be upwards of 1500+ folders and I have already written the commands to create the other folders on my server and name them automatically based off the original folder name, but the problem I have is I want my scripts to index thru all the folders and preform my commands (there are about 8 that are mostly string manipulations and such). So I was thinking of getting the count of the number of items in the Directory then write them to the text file mentioned above, then using a FOR-Loop to run that number of times that will contain my 8 or so commands? any thoughts or better ideas?
      I Can get the count using:



      wc -l FolderList.txt | awk '{ print $1 }'


      But I'm not sure how to create or manage a Dynamic Array and use it with the for-loop to index thru my commands. any guidance appreciated thank you.










      share|improve this question







      New contributor



      user354662 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Trying to automate some work stuff and this includes many folder generations but and I was thinking of using a dynamic array to do this, let me know how this sounds.



      First Part of my Script is to export a directory list using the:



      ls /home/USER/Downloads/ > "/home/USER/Desktop/scripts/FolderList.txt"


      and it gives the output as expected:



      Folder With Some Long Title
      Folder With Another Long Title


      In this example I only gave (2) but there could be upwards of 1500+ folders and I have already written the commands to create the other folders on my server and name them automatically based off the original folder name, but the problem I have is I want my scripts to index thru all the folders and preform my commands (there are about 8 that are mostly string manipulations and such). So I was thinking of getting the count of the number of items in the Directory then write them to the text file mentioned above, then using a FOR-Loop to run that number of times that will contain my 8 or so commands? any thoughts or better ideas?
      I Can get the count using:



      wc -l FolderList.txt | awk '{ print $1 }'


      But I'm not sure how to create or manage a Dynamic Array and use it with the for-loop to index thru my commands. any guidance appreciated thank you.







      bash indexing






      share|improve this question







      New contributor



      user354662 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question







      New contributor



      user354662 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question






      New contributor



      user354662 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked 38 mins ago









      user354662user354662

      132




      132




      New contributor



      user354662 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      user354662 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.
























          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          user354662 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f521873%2fread-text-list-into-dynamic-array%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          user354662 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          user354662 is a new contributor. Be nice, and check out our Code of Conduct.













          user354662 is a new contributor. Be nice, and check out our Code of Conduct.












          user354662 is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f521873%2fread-text-list-into-dynamic-array%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...