Why is this bash script read line code giving me errors?Why does my cronjob not execute my...

Is the Starlink array really visible from Earth?

Were pens caps holes designed to prevent death by suffocation if swallowed?

Defining the standard model of PA so that a space alien could understand

Is CD audio quality good enough?

Why did David Cameron offer a referendum on the European Union?

Boss wants me to falsify a report. How should I document this unethical demand?

Simple fuzz pedal using breadboard

Make 24 using exactly three 3s

Where have Brexit voters gone?

Plot twist where the antagonist wins

Pirate democracy at its finest

Cipher Block Chaining - How do you change the plaintext of all blocks?

Simple function that simulates survey results based on sample size and probability

Why were helmets and other body armour not commonplace in the 1800s?

Why do Ryanair allow me to book connecting itineraries through a third party, but not through their own website?

Why do most published works in medical imaging try to reduce false positives?

Why are C64 games inconsistent with which joystick port they use?

At what point in European history could a government build a printing press given a basic description?

Using credit/debit card details vs swiping a card in a payment (credit card) terminal

Count Even Digits In Number

Image processing: Removal of two spots in fundus images

Is the field of q-series 'dead'?

How to illustrate the Mean Value theorem?

Ticket to ride, 1910: What are the big cities



Why is this bash script read line code giving me errors?


Why does my cronjob not execute my shell-script?Capture errors in a SFTP scriptWhy does “bash -x” break this script?Why this option not working in this Bash script?Skip catching errors in a shell scriptWhy is this script giving an “Unexpected end of file” syntax error?Why can't I execute this script?Can someone explain this line of code/command please?expect script giving errorWhy does this Bash script to print command line arguments not work?






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







0















Why is this bash script read line code giving me errors?



read -p "Does this require cropping? (y/n)? " answer
case ${answer:0:1} in
y|Y )
mkdir cropped; for i in *.mp4; do ffmpeg -i "$i" -filter:v "crop=1900:1080:-20:0" cropped/"${i%.*}.mp4"; rm -r *.mp4; cd cropped; cp -r *.mp4 ../
;;
* )
mkdir no
;;
esac


When I give an answer, I get this back from terminal:



Does this require cropping? (y/n)? n
/usr/local/bin/prep: line 17: syntax error near unexpected token `;;'
/usr/local/bin/prep: line 17: ` ;;'


However, it works perfectly fine if my executed (YES) answer code is changed something like, rather than the whole mkdir cropped; for i in *.mp4...:



mkdir yes









share|improve this question





























    0















    Why is this bash script read line code giving me errors?



    read -p "Does this require cropping? (y/n)? " answer
    case ${answer:0:1} in
    y|Y )
    mkdir cropped; for i in *.mp4; do ffmpeg -i "$i" -filter:v "crop=1900:1080:-20:0" cropped/"${i%.*}.mp4"; rm -r *.mp4; cd cropped; cp -r *.mp4 ../
    ;;
    * )
    mkdir no
    ;;
    esac


    When I give an answer, I get this back from terminal:



    Does this require cropping? (y/n)? n
    /usr/local/bin/prep: line 17: syntax error near unexpected token `;;'
    /usr/local/bin/prep: line 17: ` ;;'


    However, it works perfectly fine if my executed (YES) answer code is changed something like, rather than the whole mkdir cropped; for i in *.mp4...:



    mkdir yes









    share|improve this question

























      0












      0








      0








      Why is this bash script read line code giving me errors?



      read -p "Does this require cropping? (y/n)? " answer
      case ${answer:0:1} in
      y|Y )
      mkdir cropped; for i in *.mp4; do ffmpeg -i "$i" -filter:v "crop=1900:1080:-20:0" cropped/"${i%.*}.mp4"; rm -r *.mp4; cd cropped; cp -r *.mp4 ../
      ;;
      * )
      mkdir no
      ;;
      esac


      When I give an answer, I get this back from terminal:



      Does this require cropping? (y/n)? n
      /usr/local/bin/prep: line 17: syntax error near unexpected token `;;'
      /usr/local/bin/prep: line 17: ` ;;'


      However, it works perfectly fine if my executed (YES) answer code is changed something like, rather than the whole mkdir cropped; for i in *.mp4...:



      mkdir yes









      share|improve this question














      Why is this bash script read line code giving me errors?



      read -p "Does this require cropping? (y/n)? " answer
      case ${answer:0:1} in
      y|Y )
      mkdir cropped; for i in *.mp4; do ffmpeg -i "$i" -filter:v "crop=1900:1080:-20:0" cropped/"${i%.*}.mp4"; rm -r *.mp4; cd cropped; cp -r *.mp4 ../
      ;;
      * )
      mkdir no
      ;;
      esac


      When I give an answer, I get this back from terminal:



      Does this require cropping? (y/n)? n
      /usr/local/bin/prep: line 17: syntax error near unexpected token `;;'
      /usr/local/bin/prep: line 17: ` ;;'


      However, it works perfectly fine if my executed (YES) answer code is changed something like, rather than the whole mkdir cropped; for i in *.mp4...:



      mkdir yes






      bash shell-script command-line scripting error-handling






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 46 mins ago









      AnonymousAnonymous

      1147




      1147






















          1 Answer
          1






          active

          oldest

          votes


















          1














          You are missing the done on your for loop, so the no ) and stuff is part of the loop.






          share|improve this answer
























          • Ohhhh.. you mean after *.mp4 ../ so it should be *.mp4 ../ done ?

            – Anonymous
            28 mins ago











          • seems to be missing ; done ... got it, thanks!

            – Anonymous
            24 mins ago












          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%2f521106%2fwhy-is-this-bash-script-read-line-code-giving-me-errors%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









          1














          You are missing the done on your for loop, so the no ) and stuff is part of the loop.






          share|improve this answer
























          • Ohhhh.. you mean after *.mp4 ../ so it should be *.mp4 ../ done ?

            – Anonymous
            28 mins ago











          • seems to be missing ; done ... got it, thanks!

            – Anonymous
            24 mins ago
















          1














          You are missing the done on your for loop, so the no ) and stuff is part of the loop.






          share|improve this answer
























          • Ohhhh.. you mean after *.mp4 ../ so it should be *.mp4 ../ done ?

            – Anonymous
            28 mins ago











          • seems to be missing ; done ... got it, thanks!

            – Anonymous
            24 mins ago














          1












          1








          1







          You are missing the done on your for loop, so the no ) and stuff is part of the loop.






          share|improve this answer













          You are missing the done on your for loop, so the no ) and stuff is part of the loop.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 40 mins ago









          icarusicarus

          6,76111632




          6,76111632













          • Ohhhh.. you mean after *.mp4 ../ so it should be *.mp4 ../ done ?

            – Anonymous
            28 mins ago











          • seems to be missing ; done ... got it, thanks!

            – Anonymous
            24 mins ago



















          • Ohhhh.. you mean after *.mp4 ../ so it should be *.mp4 ../ done ?

            – Anonymous
            28 mins ago











          • seems to be missing ; done ... got it, thanks!

            – Anonymous
            24 mins ago

















          Ohhhh.. you mean after *.mp4 ../ so it should be *.mp4 ../ done ?

          – Anonymous
          28 mins ago





          Ohhhh.. you mean after *.mp4 ../ so it should be *.mp4 ../ done ?

          – Anonymous
          28 mins ago













          seems to be missing ; done ... got it, thanks!

          – Anonymous
          24 mins ago





          seems to be missing ; done ... got it, thanks!

          – Anonymous
          24 mins ago


















          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%2f521106%2fwhy-is-this-bash-script-read-line-code-giving-me-errors%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...

          Ciclooctatetraenă Vezi și | Bibliografie | Meniu de navigare637866text4148569-500570979m