“mktemp: too few X's in template” if there are two sets of X in file nameIn a Bash if condition, how to...

Disabling Resource Governor in SQL Server

Why do money exchangers give different rates to different bills

Feels like I am getting dragged into office politics

Survey Confirmation - Emphasize the question or the answer?

Unexpected email from Yorkshire Bank

Selecting a secure PIN for building access

Unidentified items in bicycle tube repair kit

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

Why is this a valid proof for the harmonic series?

If Melisandre foresaw another character closing blue eyes, why did she follow Stannis?

I’ve officially counted to infinity!

Was Hulk present at this event?

Did we get closer to another plane than we were supposed to, or was the pilot just protecting our delicate sensibilities?

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

Which skill should be used for secret doors or traps: Perception or Investigation?

Binary Numbers Magic Trick

CRT Oscilloscope - part of the plot is missing

Is lying to get "gardening leave" fraud?

How did Captain America use this power?

How can I close a gap between my fence and my neighbor's that's on his side of the property line?

Would "lab meat" be able to feed a much larger global population

Does higher resolution in an image imply more bits per pixel?

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

You look catfish vs You look like a catfish?



“mktemp: too few X's in template” if there are two sets of X in file name


In a Bash if condition, how to check whether any files matching a simple wildcard expression exist?Bash command not found due to stray garbage charactersbash: I broke [[ < ]]Command behavior is different when executed by an other user (via su -c)bash tab completion not working in >& redirectionbash function for `pv fileName | sha256sum -b`What does %% mean in a function name?Why isn't the most recent version of Bash being used?What are bindable variables?Stderr redirection unexpectedly redirects some BASH built-ins as well






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







0















I am using Xenial ubuntu. The bash version is GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)



I am getting this error mktemp: too few X's in template when my shell script executes this command mktemp /tmp/1556580619403-0/duplicate.XXXXXXX.BABj9f0X1bg_work_DADYj9GphRM2_page0_preview.png



The file name is actually constructed like this in a function



myfunction() {
local filename
filename=$0
mktemp /tmp/1556580619403-0/duplicate.XXXXXXX.${filename}
}


The second occurrence of X is apparently causing the problem.



Is there any switch or other methods (other than replacing the second occurrence of X in the file name) that can resolve this issue?










share|improve this question





























    0















    I am using Xenial ubuntu. The bash version is GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)



    I am getting this error mktemp: too few X's in template when my shell script executes this command mktemp /tmp/1556580619403-0/duplicate.XXXXXXX.BABj9f0X1bg_work_DADYj9GphRM2_page0_preview.png



    The file name is actually constructed like this in a function



    myfunction() {
    local filename
    filename=$0
    mktemp /tmp/1556580619403-0/duplicate.XXXXXXX.${filename}
    }


    The second occurrence of X is apparently causing the problem.



    Is there any switch or other methods (other than replacing the second occurrence of X in the file name) that can resolve this issue?










    share|improve this question

























      0












      0








      0








      I am using Xenial ubuntu. The bash version is GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)



      I am getting this error mktemp: too few X's in template when my shell script executes this command mktemp /tmp/1556580619403-0/duplicate.XXXXXXX.BABj9f0X1bg_work_DADYj9GphRM2_page0_preview.png



      The file name is actually constructed like this in a function



      myfunction() {
      local filename
      filename=$0
      mktemp /tmp/1556580619403-0/duplicate.XXXXXXX.${filename}
      }


      The second occurrence of X is apparently causing the problem.



      Is there any switch or other methods (other than replacing the second occurrence of X in the file name) that can resolve this issue?










      share|improve this question














      I am using Xenial ubuntu. The bash version is GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)



      I am getting this error mktemp: too few X's in template when my shell script executes this command mktemp /tmp/1556580619403-0/duplicate.XXXXXXX.BABj9f0X1bg_work_DADYj9GphRM2_page0_preview.png



      The file name is actually constructed like this in a function



      myfunction() {
      local filename
      filename=$0
      mktemp /tmp/1556580619403-0/duplicate.XXXXXXX.${filename}
      }


      The second occurrence of X is apparently causing the problem.



      Is there any switch or other methods (other than replacing the second occurrence of X in the file name) that can resolve this issue?







      bash ubuntu






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 32 mins ago









      Anthony KongAnthony Kong

      3322618




      3322618






















          1 Answer
          1






          active

          oldest

          votes


















          1














          mktemp replaces the last run of Xs in the template:




          The final run of ‘X’s in the template will be replaced by alpha-numeric character




          The simplest option is to use



          mktemp /tmp/1556580619403-0/duplicate.${filename}.XXXXXXX


          If you need a file extension, see the --suffix option.






          share|improve this answer
























            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%2f516281%2fmktemp-too-few-xs-in-template-if-there-are-two-sets-of-x-in-file-name%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














            mktemp replaces the last run of Xs in the template:




            The final run of ‘X’s in the template will be replaced by alpha-numeric character




            The simplest option is to use



            mktemp /tmp/1556580619403-0/duplicate.${filename}.XXXXXXX


            If you need a file extension, see the --suffix option.






            share|improve this answer




























              1














              mktemp replaces the last run of Xs in the template:




              The final run of ‘X’s in the template will be replaced by alpha-numeric character




              The simplest option is to use



              mktemp /tmp/1556580619403-0/duplicate.${filename}.XXXXXXX


              If you need a file extension, see the --suffix option.






              share|improve this answer


























                1












                1








                1







                mktemp replaces the last run of Xs in the template:




                The final run of ‘X’s in the template will be replaced by alpha-numeric character




                The simplest option is to use



                mktemp /tmp/1556580619403-0/duplicate.${filename}.XXXXXXX


                If you need a file extension, see the --suffix option.






                share|improve this answer













                mktemp replaces the last run of Xs in the template:




                The final run of ‘X’s in the template will be replaced by alpha-numeric character




                The simplest option is to use



                mktemp /tmp/1556580619403-0/duplicate.${filename}.XXXXXXX


                If you need a file extension, see the --suffix option.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 20 mins ago









                Stephen KittStephen Kitt

                183k26421500




                183k26421500






























                    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%2f516281%2fmktemp-too-few-xs-in-template-if-there-are-two-sets-of-x-in-file-name%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...