Why my script is not working? Announcing the arrival of Valued Associate #679: Cesar Manara ...

The test team as an enemy of development? And how can this be avoided?

Asymptotics question

Caught masturbating at work

New Order #6: Easter Egg

Why datecode is SO IMPORTANT to chip manufacturers?

Is there any word for a place full of confusion?

i2c bus hangs in master RPi access to MSP430G uC ~1 in 1000 accesses

Co-worker has annoying ringtone

How many morphisms from 1 to 1+1 can there be?

Did any compiler fully use 80-bit floating point?

Why not send Voyager 3 and 4 following up the paths taken by Voyager 1 and 2 to re-transmit signals of later as they fly away from Earth?

Most effective melee weapons for arboreal combat? (pre-gunpowder technology)

How does light 'choose' between wave and particle behaviour?

How can god fight other gods?

Trying to understand entropy as a novice in thermodynamics

Does silver oxide react with hydrogen sulfide?

Why not use the yoke to control yaw, as well as pitch and roll?

A term for a woman complaining about things/begging in a cute/childish way

Simple HTTP Server

Can two people see the same photon?

Proof by mathematical induction with the problem 40(2n)! ≥ 30^n

What is the role of と after a noun when it doesn't appear to count or list anything?

What adaptations would allow standard fantasy dwarves to survive in the desert?

What is a more techy Technical Writer job title that isn't cutesy or confusing?



Why my script is not working?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionRestore Trash Script not workingSendmail shell script not workingScript not working but command works outside of scriptWhy this option not working in this Bash script?recursive script not workingHow to Group Commands After '&&' or '||' Branch and Not Invoke Subshell Variable Restriction?expect script not working in for loopHow to SSH to a list of network devices and execute a list of commands?rcX.d script not workingbash script not working properly





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







0















Hello I am trying to move a group of directories with the mv command and curly braces expansion as follows:



#!/bin/bash
...
group_name=$1
group=$((total/set))
group=$((group-1))
mkdir "$group_name""1"
mv dat{10.."$group"} "$group_name""1"
...


The function is used as follows:



grouping_dirs total set group_name



e.g: grouping_dirs 30 2 dir_name



And the list of directories I have are:



dat10 dat11 dat12 dat13 dat14 dat15 and so on.



But I want to move only the directories dat{10..14} to dir_name1.



However I get the following error:



mv: cannot stat 'dat{10..14}': No such file or directory



Even though the directories exists. I know that because I tried changing:



mv dat{10.."$group"} ... to mv dat{10..14} ...



And it worked. I think I am not correctly using " " within the curly braces, but I am rather new to bash scripting...So I would appreciate your insight!
Thanks!









share





























    0















    Hello I am trying to move a group of directories with the mv command and curly braces expansion as follows:



    #!/bin/bash
    ...
    group_name=$1
    group=$((total/set))
    group=$((group-1))
    mkdir "$group_name""1"
    mv dat{10.."$group"} "$group_name""1"
    ...


    The function is used as follows:



    grouping_dirs total set group_name



    e.g: grouping_dirs 30 2 dir_name



    And the list of directories I have are:



    dat10 dat11 dat12 dat13 dat14 dat15 and so on.



    But I want to move only the directories dat{10..14} to dir_name1.



    However I get the following error:



    mv: cannot stat 'dat{10..14}': No such file or directory



    Even though the directories exists. I know that because I tried changing:



    mv dat{10.."$group"} ... to mv dat{10..14} ...



    And it worked. I think I am not correctly using " " within the curly braces, but I am rather new to bash scripting...So I would appreciate your insight!
    Thanks!









    share

























      0












      0








      0








      Hello I am trying to move a group of directories with the mv command and curly braces expansion as follows:



      #!/bin/bash
      ...
      group_name=$1
      group=$((total/set))
      group=$((group-1))
      mkdir "$group_name""1"
      mv dat{10.."$group"} "$group_name""1"
      ...


      The function is used as follows:



      grouping_dirs total set group_name



      e.g: grouping_dirs 30 2 dir_name



      And the list of directories I have are:



      dat10 dat11 dat12 dat13 dat14 dat15 and so on.



      But I want to move only the directories dat{10..14} to dir_name1.



      However I get the following error:



      mv: cannot stat 'dat{10..14}': No such file or directory



      Even though the directories exists. I know that because I tried changing:



      mv dat{10.."$group"} ... to mv dat{10..14} ...



      And it worked. I think I am not correctly using " " within the curly braces, but I am rather new to bash scripting...So I would appreciate your insight!
      Thanks!









      share














      Hello I am trying to move a group of directories with the mv command and curly braces expansion as follows:



      #!/bin/bash
      ...
      group_name=$1
      group=$((total/set))
      group=$((group-1))
      mkdir "$group_name""1"
      mv dat{10.."$group"} "$group_name""1"
      ...


      The function is used as follows:



      grouping_dirs total set group_name



      e.g: grouping_dirs 30 2 dir_name



      And the list of directories I have are:



      dat10 dat11 dat12 dat13 dat14 dat15 and so on.



      But I want to move only the directories dat{10..14} to dir_name1.



      However I get the following error:



      mv: cannot stat 'dat{10..14}': No such file or directory



      Even though the directories exists. I know that because I tried changing:



      mv dat{10.."$group"} ... to mv dat{10..14} ...



      And it worked. I think I am not correctly using " " within the curly braces, but I am rather new to bash scripting...So I would appreciate your insight!
      Thanks!







      shell-script scripting





      share












      share










      share



      share










      asked 7 mins ago









      dareToDiffer07dareToDiffer07

      52




      52






















          0






          active

          oldest

          votes












          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%2f513626%2fwhy-my-script-is-not-working%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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%2f513626%2fwhy-my-script-is-not-working%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...