Not found argument in -exec [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:



  • How to run find -exec?

    6 answers



I have such a problem, I'm trying to output a list of movies without the names of directories in the file, but I have a bug, the argument is not found in the -exeс, below is the code



$ find . -name "*.avi" -o -name "*.mkv" -exec basename > ~/Bash/test/rm/films.txt






share|improve this question














marked as duplicate by Jesse_b, Christopher, Community♦ Feb 26 at 16:46


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.














  • find: there is no argument to "-exec"
    – Ð”митрий Смирнов
    Feb 26 at 16:27










  • you're missing a ;. Also it appears to work for me but I don't believe there is any reason to escape
    – Jesse_b
    Feb 26 at 16:30














up vote
0
down vote

favorite













This question already has an answer here:



  • How to run find -exec?

    6 answers



I have such a problem, I'm trying to output a list of movies without the names of directories in the file, but I have a bug, the argument is not found in the -exeс, below is the code



$ find . -name "*.avi" -o -name "*.mkv" -exec basename > ~/Bash/test/rm/films.txt






share|improve this question














marked as duplicate by Jesse_b, Christopher, Community♦ Feb 26 at 16:46


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.














  • find: there is no argument to "-exec"
    – Ð”митрий Смирнов
    Feb 26 at 16:27










  • you're missing a ;. Also it appears to work for me but I don't believe there is any reason to escape
    – Jesse_b
    Feb 26 at 16:30












up vote
0
down vote

favorite









up vote
0
down vote

favorite












This question already has an answer here:



  • How to run find -exec?

    6 answers



I have such a problem, I'm trying to output a list of movies without the names of directories in the file, but I have a bug, the argument is not found in the -exeс, below is the code



$ find . -name "*.avi" -o -name "*.mkv" -exec basename > ~/Bash/test/rm/films.txt






share|improve this question















This question already has an answer here:



  • How to run find -exec?

    6 answers



I have such a problem, I'm trying to output a list of movies without the names of directories in the file, but I have a bug, the argument is not found in the -exeс, below is the code



$ find . -name "*.avi" -o -name "*.mkv" -exec basename > ~/Bash/test/rm/films.txt




This question already has an answer here:



  • How to run find -exec?

    6 answers









share|improve this question













share|improve this question




share|improve this question








edited Feb 26 at 16:29









Jeff Schaller

31.2k846105




31.2k846105










asked Feb 26 at 16:26









Дмитрий Смирнов

31




31




marked as duplicate by Jesse_b, Christopher, Community♦ Feb 26 at 16:46


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 Jesse_b, Christopher, Community♦ Feb 26 at 16:46


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.













  • find: there is no argument to "-exec"
    – Ð”митрий Смирнов
    Feb 26 at 16:27










  • you're missing a ;. Also it appears to work for me but I don't believe there is any reason to escape
    – Jesse_b
    Feb 26 at 16:30
















  • find: there is no argument to "-exec"
    – Ð”митрий Смирнов
    Feb 26 at 16:27










  • you're missing a ;. Also it appears to work for me but I don't believe there is any reason to escape
    – Jesse_b
    Feb 26 at 16:30















find: there is no argument to "-exec"
– Ð”митрий Смирнов
Feb 26 at 16:27




find: there is no argument to "-exec"
– Ð”митрий Смирнов
Feb 26 at 16:27












you're missing a ;. Also it appears to work for me but I don't believe there is any reason to escape
– Jesse_b
Feb 26 at 16:30




you're missing a ;. Also it appears to work for me but I don't believe there is any reason to escape
– Jesse_b
Feb 26 at 16:30










2 Answers
2






active

oldest

votes

















up vote
3
down vote



accepted










Try this instead :



$ find . ( -name "*.avi" -o -name "*.mkv" ) -exec basename ; > ~/Bash/test/rm/films.txt





share|improve this answer






















  • I tried, the same thing
    – Ð”митрий Смирнов
    Feb 26 at 16:32











  • Thank you very much, your change worked, I so wanted to do, but I thought that after ";" code will not work anymore, Thanks again, your answer is the best
    – Ð”митрий Смирнов
    Feb 26 at 16:45










  • When you have multiple conditions, you should use parentheses like here, it's mandatory
    – Gilles Quenot
    Feb 26 at 16:49










  • @GillesQuenot It's only "mandatory" if the precedence of the conditions (OR/AND) matter.
    – Kusalananda
    Feb 26 at 16:50










  • @Kusalananda: I agree
    – Gilles Quenot
    Feb 26 at 16:51

















up vote
4
down vote













There are two typos in your command.



  1. should be


  2. The ␣ (backslash+space) should be ; or ';'.


The -exec option/predicate of find needs to know where the command that it executes ends. It is told this by the ; at the end (which needs to be quoted to protect it from the shell).



You should not need to escape or quote .



There might be some issues with precedence too. You basically say



condition OR condition AND run-this-command


which is ambiguous. It would be better to say



(condition OR condition) AND run-this-command


This does that:



find . -type f '(' -name '*.avi' -o -name '*.mkv' ')' 
-exec basename ';' > ~/Bash/test/rm/films.txt


I've also added -type f so that only regular files are considered.






share|improve this answer





























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote



    accepted










    Try this instead :



    $ find . ( -name "*.avi" -o -name "*.mkv" ) -exec basename ; > ~/Bash/test/rm/films.txt





    share|improve this answer






















    • I tried, the same thing
      – Ð”митрий Смирнов
      Feb 26 at 16:32











    • Thank you very much, your change worked, I so wanted to do, but I thought that after ";" code will not work anymore, Thanks again, your answer is the best
      – Ð”митрий Смирнов
      Feb 26 at 16:45










    • When you have multiple conditions, you should use parentheses like here, it's mandatory
      – Gilles Quenot
      Feb 26 at 16:49










    • @GillesQuenot It's only "mandatory" if the precedence of the conditions (OR/AND) matter.
      – Kusalananda
      Feb 26 at 16:50










    • @Kusalananda: I agree
      – Gilles Quenot
      Feb 26 at 16:51














    up vote
    3
    down vote



    accepted










    Try this instead :



    $ find . ( -name "*.avi" -o -name "*.mkv" ) -exec basename ; > ~/Bash/test/rm/films.txt





    share|improve this answer






















    • I tried, the same thing
      – Ð”митрий Смирнов
      Feb 26 at 16:32











    • Thank you very much, your change worked, I so wanted to do, but I thought that after ";" code will not work anymore, Thanks again, your answer is the best
      – Ð”митрий Смирнов
      Feb 26 at 16:45










    • When you have multiple conditions, you should use parentheses like here, it's mandatory
      – Gilles Quenot
      Feb 26 at 16:49










    • @GillesQuenot It's only "mandatory" if the precedence of the conditions (OR/AND) matter.
      – Kusalananda
      Feb 26 at 16:50










    • @Kusalananda: I agree
      – Gilles Quenot
      Feb 26 at 16:51












    up vote
    3
    down vote



    accepted







    up vote
    3
    down vote



    accepted






    Try this instead :



    $ find . ( -name "*.avi" -o -name "*.mkv" ) -exec basename ; > ~/Bash/test/rm/films.txt





    share|improve this answer














    Try this instead :



    $ find . ( -name "*.avi" -o -name "*.mkv" ) -exec basename ; > ~/Bash/test/rm/films.txt






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Feb 26 at 16:44

























    answered Feb 26 at 16:30









    Gilles Quenot

    15.3k13448




    15.3k13448











    • I tried, the same thing
      – Ð”митрий Смирнов
      Feb 26 at 16:32











    • Thank you very much, your change worked, I so wanted to do, but I thought that after ";" code will not work anymore, Thanks again, your answer is the best
      – Ð”митрий Смирнов
      Feb 26 at 16:45










    • When you have multiple conditions, you should use parentheses like here, it's mandatory
      – Gilles Quenot
      Feb 26 at 16:49










    • @GillesQuenot It's only "mandatory" if the precedence of the conditions (OR/AND) matter.
      – Kusalananda
      Feb 26 at 16:50










    • @Kusalananda: I agree
      – Gilles Quenot
      Feb 26 at 16:51
















    • I tried, the same thing
      – Ð”митрий Смирнов
      Feb 26 at 16:32











    • Thank you very much, your change worked, I so wanted to do, but I thought that after ";" code will not work anymore, Thanks again, your answer is the best
      – Ð”митрий Смирнов
      Feb 26 at 16:45










    • When you have multiple conditions, you should use parentheses like here, it's mandatory
      – Gilles Quenot
      Feb 26 at 16:49










    • @GillesQuenot It's only "mandatory" if the precedence of the conditions (OR/AND) matter.
      – Kusalananda
      Feb 26 at 16:50










    • @Kusalananda: I agree
      – Gilles Quenot
      Feb 26 at 16:51















    I tried, the same thing
    – Ð”митрий Смирнов
    Feb 26 at 16:32





    I tried, the same thing
    – Ð”митрий Смирнов
    Feb 26 at 16:32













    Thank you very much, your change worked, I so wanted to do, but I thought that after ";" code will not work anymore, Thanks again, your answer is the best
    – Ð”митрий Смирнов
    Feb 26 at 16:45




    Thank you very much, your change worked, I so wanted to do, but I thought that after ";" code will not work anymore, Thanks again, your answer is the best
    – Ð”митрий Смирнов
    Feb 26 at 16:45












    When you have multiple conditions, you should use parentheses like here, it's mandatory
    – Gilles Quenot
    Feb 26 at 16:49




    When you have multiple conditions, you should use parentheses like here, it's mandatory
    – Gilles Quenot
    Feb 26 at 16:49












    @GillesQuenot It's only "mandatory" if the precedence of the conditions (OR/AND) matter.
    – Kusalananda
    Feb 26 at 16:50




    @GillesQuenot It's only "mandatory" if the precedence of the conditions (OR/AND) matter.
    – Kusalananda
    Feb 26 at 16:50












    @Kusalananda: I agree
    – Gilles Quenot
    Feb 26 at 16:51




    @Kusalananda: I agree
    – Gilles Quenot
    Feb 26 at 16:51












    up vote
    4
    down vote













    There are two typos in your command.



    1. should be


    2. The ␣ (backslash+space) should be ; or ';'.


    The -exec option/predicate of find needs to know where the command that it executes ends. It is told this by the ; at the end (which needs to be quoted to protect it from the shell).



    You should not need to escape or quote .



    There might be some issues with precedence too. You basically say



    condition OR condition AND run-this-command


    which is ambiguous. It would be better to say



    (condition OR condition) AND run-this-command


    This does that:



    find . -type f '(' -name '*.avi' -o -name '*.mkv' ')' 
    -exec basename ';' > ~/Bash/test/rm/films.txt


    I've also added -type f so that only regular files are considered.






    share|improve this answer


























      up vote
      4
      down vote













      There are two typos in your command.



      1. should be


      2. The ␣ (backslash+space) should be ; or ';'.


      The -exec option/predicate of find needs to know where the command that it executes ends. It is told this by the ; at the end (which needs to be quoted to protect it from the shell).



      You should not need to escape or quote .



      There might be some issues with precedence too. You basically say



      condition OR condition AND run-this-command


      which is ambiguous. It would be better to say



      (condition OR condition) AND run-this-command


      This does that:



      find . -type f '(' -name '*.avi' -o -name '*.mkv' ')' 
      -exec basename ';' > ~/Bash/test/rm/films.txt


      I've also added -type f so that only regular files are considered.






      share|improve this answer
























        up vote
        4
        down vote










        up vote
        4
        down vote









        There are two typos in your command.



        1. should be


        2. The ␣ (backslash+space) should be ; or ';'.


        The -exec option/predicate of find needs to know where the command that it executes ends. It is told this by the ; at the end (which needs to be quoted to protect it from the shell).



        You should not need to escape or quote .



        There might be some issues with precedence too. You basically say



        condition OR condition AND run-this-command


        which is ambiguous. It would be better to say



        (condition OR condition) AND run-this-command


        This does that:



        find . -type f '(' -name '*.avi' -o -name '*.mkv' ')' 
        -exec basename ';' > ~/Bash/test/rm/films.txt


        I've also added -type f so that only regular files are considered.






        share|improve this answer














        There are two typos in your command.



        1. should be


        2. The ␣ (backslash+space) should be ; or ';'.


        The -exec option/predicate of find needs to know where the command that it executes ends. It is told this by the ; at the end (which needs to be quoted to protect it from the shell).



        You should not need to escape or quote .



        There might be some issues with precedence too. You basically say



        condition OR condition AND run-this-command


        which is ambiguous. It would be better to say



        (condition OR condition) AND run-this-command


        This does that:



        find . -type f '(' -name '*.avi' -o -name '*.mkv' ')' 
        -exec basename ';' > ~/Bash/test/rm/films.txt


        I've also added -type f so that only regular files are considered.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 26 at 16:48

























        answered Feb 26 at 16:30









        Kusalananda

        103k13202318




        103k13202318












            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?