The command “find” output an error message

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I would like to inquire about an error message that I get when I run the command "find". In the following paragraph, I will explain what I am trying to accomplish.



I have a parent folder. Inside this folder there are many subfolders. Inside each subfolder there are plenty of sub-sub folders. I would like to list the sub-sub folders that contain a specific number of files. I ran for loop as follows:



#!/bin/bash
in=PATH_TO_THE_PARENT_FOLDER

for i in $in/*; do
find $i -maxdepth 1 -type d -print0 | xargs -0 -I sh -c 'echo -e $(find | wc -l) ' | sort -n | grep -w 69 | awk 'print $2' #69 represent the total number of files within a folder
done


This code output the following error message "sh: MPR_Range: No such file or directory". I Googled looking for an explanation for what "sh: MPR_Range" means, but I couldn't find any answer.







share|improve this question

























    up vote
    0
    down vote

    favorite












    I would like to inquire about an error message that I get when I run the command "find". In the following paragraph, I will explain what I am trying to accomplish.



    I have a parent folder. Inside this folder there are many subfolders. Inside each subfolder there are plenty of sub-sub folders. I would like to list the sub-sub folders that contain a specific number of files. I ran for loop as follows:



    #!/bin/bash
    in=PATH_TO_THE_PARENT_FOLDER

    for i in $in/*; do
    find $i -maxdepth 1 -type d -print0 | xargs -0 -I sh -c 'echo -e $(find | wc -l) ' | sort -n | grep -w 69 | awk 'print $2' #69 represent the total number of files within a folder
    done


    This code output the following error message "sh: MPR_Range: No such file or directory". I Googled looking for an explanation for what "sh: MPR_Range" means, but I couldn't find any answer.







    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I would like to inquire about an error message that I get when I run the command "find". In the following paragraph, I will explain what I am trying to accomplish.



      I have a parent folder. Inside this folder there are many subfolders. Inside each subfolder there are plenty of sub-sub folders. I would like to list the sub-sub folders that contain a specific number of files. I ran for loop as follows:



      #!/bin/bash
      in=PATH_TO_THE_PARENT_FOLDER

      for i in $in/*; do
      find $i -maxdepth 1 -type d -print0 | xargs -0 -I sh -c 'echo -e $(find | wc -l) ' | sort -n | grep -w 69 | awk 'print $2' #69 represent the total number of files within a folder
      done


      This code output the following error message "sh: MPR_Range: No such file or directory". I Googled looking for an explanation for what "sh: MPR_Range" means, but I couldn't find any answer.







      share|improve this question













      I would like to inquire about an error message that I get when I run the command "find". In the following paragraph, I will explain what I am trying to accomplish.



      I have a parent folder. Inside this folder there are many subfolders. Inside each subfolder there are plenty of sub-sub folders. I would like to list the sub-sub folders that contain a specific number of files. I ran for loop as follows:



      #!/bin/bash
      in=PATH_TO_THE_PARENT_FOLDER

      for i in $in/*; do
      find $i -maxdepth 1 -type d -print0 | xargs -0 -I sh -c 'echo -e $(find | wc -l) ' | sort -n | grep -w 69 | awk 'print $2' #69 represent the total number of files within a folder
      done


      This code output the following error message "sh: MPR_Range: No such file or directory". I Googled looking for an explanation for what "sh: MPR_Range" means, but I couldn't find any answer.









      share|improve this question












      share|improve this question




      share|improve this question








      edited Jun 6 at 15:57
























      asked Jun 6 at 13:35









      goro

      78841533




      78841533




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          Assume you have a file called foo&bar. xargs will now run the command



          sh -c 'echo -e $(find foo&bar | wc -l) foo&bar' 


          That runs echo and find in the background, and two copies of bar. Similarly for foo;bar, and $(bar).



          Don't use in the argument to sh -c, instead, give the filename as a separate argument, i.e.



          ... |xargs sh -c 'echo -e $(find "$1" | wc -l) "$1"' sh | ...


          In addition, you could use find -exec instead of xargs:



          find -type d -exec sh -c 'echo ...' ; 


          I'm also not exactly sure if the sort is necessary, if you running grep to find lines with particular numbers anyway.






          share|improve this answer

















          • 1




            @goro, of course, for that to produce that error, you'd need to have some file with MPR_Range and other appropriate characters in the file name, but that looks like it would be the most likely explanation here
            – ilkkachu
            Jun 6 at 16:03










          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          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%2f448206%2fthe-command-find-output-an-error-message%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          Assume you have a file called foo&bar. xargs will now run the command



          sh -c 'echo -e $(find foo&bar | wc -l) foo&bar' 


          That runs echo and find in the background, and two copies of bar. Similarly for foo;bar, and $(bar).



          Don't use in the argument to sh -c, instead, give the filename as a separate argument, i.e.



          ... |xargs sh -c 'echo -e $(find "$1" | wc -l) "$1"' sh | ...


          In addition, you could use find -exec instead of xargs:



          find -type d -exec sh -c 'echo ...' ; 


          I'm also not exactly sure if the sort is necessary, if you running grep to find lines with particular numbers anyway.






          share|improve this answer

















          • 1




            @goro, of course, for that to produce that error, you'd need to have some file with MPR_Range and other appropriate characters in the file name, but that looks like it would be the most likely explanation here
            – ilkkachu
            Jun 6 at 16:03














          up vote
          3
          down vote



          accepted










          Assume you have a file called foo&bar. xargs will now run the command



          sh -c 'echo -e $(find foo&bar | wc -l) foo&bar' 


          That runs echo and find in the background, and two copies of bar. Similarly for foo;bar, and $(bar).



          Don't use in the argument to sh -c, instead, give the filename as a separate argument, i.e.



          ... |xargs sh -c 'echo -e $(find "$1" | wc -l) "$1"' sh | ...


          In addition, you could use find -exec instead of xargs:



          find -type d -exec sh -c 'echo ...' ; 


          I'm also not exactly sure if the sort is necessary, if you running grep to find lines with particular numbers anyway.






          share|improve this answer

















          • 1




            @goro, of course, for that to produce that error, you'd need to have some file with MPR_Range and other appropriate characters in the file name, but that looks like it would be the most likely explanation here
            – ilkkachu
            Jun 6 at 16:03












          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          Assume you have a file called foo&bar. xargs will now run the command



          sh -c 'echo -e $(find foo&bar | wc -l) foo&bar' 


          That runs echo and find in the background, and two copies of bar. Similarly for foo;bar, and $(bar).



          Don't use in the argument to sh -c, instead, give the filename as a separate argument, i.e.



          ... |xargs sh -c 'echo -e $(find "$1" | wc -l) "$1"' sh | ...


          In addition, you could use find -exec instead of xargs:



          find -type d -exec sh -c 'echo ...' ; 


          I'm also not exactly sure if the sort is necessary, if you running grep to find lines with particular numbers anyway.






          share|improve this answer













          Assume you have a file called foo&bar. xargs will now run the command



          sh -c 'echo -e $(find foo&bar | wc -l) foo&bar' 


          That runs echo and find in the background, and two copies of bar. Similarly for foo;bar, and $(bar).



          Don't use in the argument to sh -c, instead, give the filename as a separate argument, i.e.



          ... |xargs sh -c 'echo -e $(find "$1" | wc -l) "$1"' sh | ...


          In addition, you could use find -exec instead of xargs:



          find -type d -exec sh -c 'echo ...' ; 


          I'm also not exactly sure if the sort is necessary, if you running grep to find lines with particular numbers anyway.







          share|improve this answer













          share|improve this answer



          share|improve this answer











          answered Jun 6 at 14:09









          ilkkachu

          47.7k668131




          47.7k668131







          • 1




            @goro, of course, for that to produce that error, you'd need to have some file with MPR_Range and other appropriate characters in the file name, but that looks like it would be the most likely explanation here
            – ilkkachu
            Jun 6 at 16:03












          • 1




            @goro, of course, for that to produce that error, you'd need to have some file with MPR_Range and other appropriate characters in the file name, but that looks like it would be the most likely explanation here
            – ilkkachu
            Jun 6 at 16:03







          1




          1




          @goro, of course, for that to produce that error, you'd need to have some file with MPR_Range and other appropriate characters in the file name, but that looks like it would be the most likely explanation here
          – ilkkachu
          Jun 6 at 16:03




          @goro, of course, for that to produce that error, you'd need to have some file with MPR_Range and other appropriate characters in the file name, but that looks like it would be the most likely explanation here
          – ilkkachu
          Jun 6 at 16:03












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f448206%2fthe-command-find-output-an-error-message%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

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

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?