Bash script to execute command with file from directory and conditionawk with variables in condition and in output redirection fileScript to read line by line from a file pipe that to another command and output to another filefind on bash script ignoring folders with bracketsUsing basename to strip file extension and search for files with the same nameRunning a command multiple times with arguments (filenames) from a file?desktop action with bash command and terminalscript / command to get IPs from list of hostnames and combine into a single fileRead from a file which has integer values in every separate line and then if a condition is met execute a statementRead command in bash script not executing as a read command and outputting text straight to command linePortable way to run command without PATH from bash script

What is the most remote airport from the center of the city it supposedly serves?

Hang 20lb projector screen on hardieplank

Why is Arya visibly scared in the library in S8E3?

Map one pandas column using two dictionaries

Was the ancestor of SCSI, the SASI protocol, nothing more than a draft?

Melee attacking upwards (enemy on 10ft ceiling)

Visualizing a complicated Region

Survey Confirmation - Emphasize the question or the answer?

What happened to Rhaegal?

Password expiration with Password manager

Can fracking help reduce CO2?

A non-technological, repeating, visible object in the sky, holding its position in the sky for hours

Plagiarism in class. Could it be my fault?

Visa for volunteering in England

Is lying to get "gardening leave" fraud?

Why is Thanos so tough at the beginning of "Avengers: Endgame"?

Does it look bad as a candidate if I apply to two post-doctoral positions at the same national research laboratory?

Game of Life meets Chaos Theory

Accidentally deleted the "/usr/share" folder

Is thermodynamics only applicable to systems in equilibrium?

When and why did journal article titles become descriptive, rather than creatively allusive?

How to reply this mail from potential PhD professor?

Does the time required to copy a spell into a spellbook have to be consecutive, or is that just the cumulative time required?

Why is the SNP putting so much emphasis on currency plans?



Bash script to execute command with file from directory and condition


awk with variables in condition and in output redirection fileScript to read line by line from a file pipe that to another command and output to another filefind on bash script ignoring folders with bracketsUsing basename to strip file extension and search for files with the same nameRunning a command multiple times with arguments (filenames) from a file?desktop action with bash command and terminalscript / command to get IPs from list of hostnames and combine into a single fileRead from a file which has integer values in every separate line and then if a condition is met execute a statementRead command in bash script not executing as a read command and outputting text straight to command linePortable way to run command without PATH from bash script






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








2















I'd like to sort my figlet fonts with testing, so I've decided to make a script, which will demonstrate figlet font one by one and will delete fonts I don't like.
I've tried to find the solution for correct if-then condition inside while loop, but couldn't find one.
Here's the script itself, but for now it just provides examples of all the fonts in the single scroll:



#!/bin/bash
#script to test figlet fonts
rm /usr/share/figlet/list.txt #delete old list
ls /usr/share/figlet > /usr/share/figlet/list.txt #create new list
filename='/usr/share/figlet/list.txt'
n=1
while read line; do
figlet -f $line Figlet
echo -e "Press 0 if you don't like it, font will be deleted"
read decision
if [ "$decision" = "0" ]; then
rm "/usr/share/figlet/$line"
echo -e "Font deleted"
else
echo -e "Font saved"
fi
n=$((n+1))
done < $filename









share|improve this question






























    2















    I'd like to sort my figlet fonts with testing, so I've decided to make a script, which will demonstrate figlet font one by one and will delete fonts I don't like.
    I've tried to find the solution for correct if-then condition inside while loop, but couldn't find one.
    Here's the script itself, but for now it just provides examples of all the fonts in the single scroll:



    #!/bin/bash
    #script to test figlet fonts
    rm /usr/share/figlet/list.txt #delete old list
    ls /usr/share/figlet > /usr/share/figlet/list.txt #create new list
    filename='/usr/share/figlet/list.txt'
    n=1
    while read line; do
    figlet -f $line Figlet
    echo -e "Press 0 if you don't like it, font will be deleted"
    read decision
    if [ "$decision" = "0" ]; then
    rm "/usr/share/figlet/$line"
    echo -e "Font deleted"
    else
    echo -e "Font saved"
    fi
    n=$((n+1))
    done < $filename









    share|improve this question


























      2












      2








      2








      I'd like to sort my figlet fonts with testing, so I've decided to make a script, which will demonstrate figlet font one by one and will delete fonts I don't like.
      I've tried to find the solution for correct if-then condition inside while loop, but couldn't find one.
      Here's the script itself, but for now it just provides examples of all the fonts in the single scroll:



      #!/bin/bash
      #script to test figlet fonts
      rm /usr/share/figlet/list.txt #delete old list
      ls /usr/share/figlet > /usr/share/figlet/list.txt #create new list
      filename='/usr/share/figlet/list.txt'
      n=1
      while read line; do
      figlet -f $line Figlet
      echo -e "Press 0 if you don't like it, font will be deleted"
      read decision
      if [ "$decision" = "0" ]; then
      rm "/usr/share/figlet/$line"
      echo -e "Font deleted"
      else
      echo -e "Font saved"
      fi
      n=$((n+1))
      done < $filename









      share|improve this question
















      I'd like to sort my figlet fonts with testing, so I've decided to make a script, which will demonstrate figlet font one by one and will delete fonts I don't like.
      I've tried to find the solution for correct if-then condition inside while loop, but couldn't find one.
      Here's the script itself, but for now it just provides examples of all the fonts in the single scroll:



      #!/bin/bash
      #script to test figlet fonts
      rm /usr/share/figlet/list.txt #delete old list
      ls /usr/share/figlet > /usr/share/figlet/list.txt #create new list
      filename='/usr/share/figlet/list.txt'
      n=1
      while read line; do
      figlet -f $line Figlet
      echo -e "Press 0 if you don't like it, font will be deleted"
      read decision
      if [ "$decision" = "0" ]; then
      rm "/usr/share/figlet/$line"
      echo -e "Font deleted"
      else
      echo -e "Font saved"
      fi
      n=$((n+1))
      done < $filename






      shell-script






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 22 at 11:27







      FCW

















      asked Apr 22 at 10:42









      FCWFCW

      112




      112




















          1 Answer
          1






          active

          oldest

          votes


















          3














          The original problem, is that content of your file list is being fed to read decision and while cycle doesn't work as you expect.
          Though why do you need a list at all?



          Better to iterate through files with for cycle.



          #!/bin/bash
          for font in /usr/share/figlet/*; do
          figlet -f "$font" Figlet
          echo -e "Press 0 if you don't like it, font will be deleted"
          read decision
          if [ "$decision" = "0" ]; then
          rm "$font"
          echo -e "Font deleted"
          else
          echo -e "Font saved"
          fi
          done





          share|improve this answer

























          • @FCW If one of the answers solved your issue, please take a moment to accept it by clicking on the checkmark on the left. That will mark the question as answered and is the way that thanks are conveyed on the Stack Exchange sites.

            – terdon
            Apr 22 at 12:26











          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
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f513783%2fbash-script-to-execute-command-with-file-from-directory-and-condition%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          The original problem, is that content of your file list is being fed to read decision and while cycle doesn't work as you expect.
          Though why do you need a list at all?



          Better to iterate through files with for cycle.



          #!/bin/bash
          for font in /usr/share/figlet/*; do
          figlet -f "$font" Figlet
          echo -e "Press 0 if you don't like it, font will be deleted"
          read decision
          if [ "$decision" = "0" ]; then
          rm "$font"
          echo -e "Font deleted"
          else
          echo -e "Font saved"
          fi
          done





          share|improve this answer

























          • @FCW If one of the answers solved your issue, please take a moment to accept it by clicking on the checkmark on the left. That will mark the question as answered and is the way that thanks are conveyed on the Stack Exchange sites.

            – terdon
            Apr 22 at 12:26















          3














          The original problem, is that content of your file list is being fed to read decision and while cycle doesn't work as you expect.
          Though why do you need a list at all?



          Better to iterate through files with for cycle.



          #!/bin/bash
          for font in /usr/share/figlet/*; do
          figlet -f "$font" Figlet
          echo -e "Press 0 if you don't like it, font will be deleted"
          read decision
          if [ "$decision" = "0" ]; then
          rm "$font"
          echo -e "Font deleted"
          else
          echo -e "Font saved"
          fi
          done





          share|improve this answer

























          • @FCW If one of the answers solved your issue, please take a moment to accept it by clicking on the checkmark on the left. That will mark the question as answered and is the way that thanks are conveyed on the Stack Exchange sites.

            – terdon
            Apr 22 at 12:26













          3












          3








          3







          The original problem, is that content of your file list is being fed to read decision and while cycle doesn't work as you expect.
          Though why do you need a list at all?



          Better to iterate through files with for cycle.



          #!/bin/bash
          for font in /usr/share/figlet/*; do
          figlet -f "$font" Figlet
          echo -e "Press 0 if you don't like it, font will be deleted"
          read decision
          if [ "$decision" = "0" ]; then
          rm "$font"
          echo -e "Font deleted"
          else
          echo -e "Font saved"
          fi
          done





          share|improve this answer















          The original problem, is that content of your file list is being fed to read decision and while cycle doesn't work as you expect.
          Though why do you need a list at all?



          Better to iterate through files with for cycle.



          #!/bin/bash
          for font in /usr/share/figlet/*; do
          figlet -f "$font" Figlet
          echo -e "Press 0 if you don't like it, font will be deleted"
          read decision
          if [ "$decision" = "0" ]; then
          rm "$font"
          echo -e "Font deleted"
          else
          echo -e "Font saved"
          fi
          done






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 22 at 11:03

























          answered Apr 22 at 10:52









          rushrush

          19.8k46696




          19.8k46696












          • @FCW If one of the answers solved your issue, please take a moment to accept it by clicking on the checkmark on the left. That will mark the question as answered and is the way that thanks are conveyed on the Stack Exchange sites.

            – terdon
            Apr 22 at 12:26

















          • @FCW If one of the answers solved your issue, please take a moment to accept it by clicking on the checkmark on the left. That will mark the question as answered and is the way that thanks are conveyed on the Stack Exchange sites.

            – terdon
            Apr 22 at 12:26
















          @FCW If one of the answers solved your issue, please take a moment to accept it by clicking on the checkmark on the left. That will mark the question as answered and is the way that thanks are conveyed on the Stack Exchange sites.

          – terdon
          Apr 22 at 12:26





          @FCW If one of the answers solved your issue, please take a moment to accept it by clicking on the checkmark on the left. That will mark the question as answered and is the way that thanks are conveyed on the Stack Exchange sites.

          – terdon
          Apr 22 at 12:26

















          draft saved

          draft discarded
















































          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%2f513783%2fbash-script-to-execute-command-with-file-from-directory-and-condition%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

          How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

          What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

          Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos