alias slowed down zsh












1















I've added an alias and slowed down my zsh opening time. It opens but just hangs for extra 1 or 2 seconds to give me a prompt (or it starts typing my command without prompt before it, at the top of the shell)



There is an another question about it, but it resulted in that slowing down is not about aliases.



Do aliases slow down a shell's start?



I have an alias, which helps me start the android emulator based on the name one of the avd names from the list, wait 2 seconds, and then run flutter.



alias runflutter="emulator @$(avdmanager list avd | grep -m 1 -Po '(?<=Name:s).*'  ) &; sleep 2;  flutter run"


Main reason that I'm sure that my problem is about that alias is, when I test with /usr/bin/time zsh -i -c exit
Gives me this:



2.27user 0.18system 0:01.07elapsed 228%CPU (0avgtext+0avgdata 141092maxresident)k
0inputs+112outputs (0major+50607minor)pagefaults 0swaps


If delete my alias the output of the same command



0.24user 0.11system 0:00.35elapsed 100%CPU (0avgtext+0avgdata 16036maxresident)k
0inputs+96outputs (0major+16089minor)pagefaults 0swaps


What are my thoughts and done so far



I thought that I've already flutter command, so maybe having an alias with the flutter keyword on it cause some indexing problems, not sure if indexing or something similar exists. So I have renamed my alias, nothing changed.



My other theory is, since there is almost 2 second delay and 2.0 difference between the numbers before the 'user' in the output, I thought it might be about my sleep command in the alias. It's executed somehow. I've deleted sleep command from my alias but didn't help.










share|improve this question



























    1















    I've added an alias and slowed down my zsh opening time. It opens but just hangs for extra 1 or 2 seconds to give me a prompt (or it starts typing my command without prompt before it, at the top of the shell)



    There is an another question about it, but it resulted in that slowing down is not about aliases.



    Do aliases slow down a shell's start?



    I have an alias, which helps me start the android emulator based on the name one of the avd names from the list, wait 2 seconds, and then run flutter.



    alias runflutter="emulator @$(avdmanager list avd | grep -m 1 -Po '(?<=Name:s).*'  ) &; sleep 2;  flutter run"


    Main reason that I'm sure that my problem is about that alias is, when I test with /usr/bin/time zsh -i -c exit
    Gives me this:



    2.27user 0.18system 0:01.07elapsed 228%CPU (0avgtext+0avgdata 141092maxresident)k
    0inputs+112outputs (0major+50607minor)pagefaults 0swaps


    If delete my alias the output of the same command



    0.24user 0.11system 0:00.35elapsed 100%CPU (0avgtext+0avgdata 16036maxresident)k
    0inputs+96outputs (0major+16089minor)pagefaults 0swaps


    What are my thoughts and done so far



    I thought that I've already flutter command, so maybe having an alias with the flutter keyword on it cause some indexing problems, not sure if indexing or something similar exists. So I have renamed my alias, nothing changed.



    My other theory is, since there is almost 2 second delay and 2.0 difference between the numbers before the 'user' in the output, I thought it might be about my sleep command in the alias. It's executed somehow. I've deleted sleep command from my alias but didn't help.










    share|improve this question

























      1












      1








      1








      I've added an alias and slowed down my zsh opening time. It opens but just hangs for extra 1 or 2 seconds to give me a prompt (or it starts typing my command without prompt before it, at the top of the shell)



      There is an another question about it, but it resulted in that slowing down is not about aliases.



      Do aliases slow down a shell's start?



      I have an alias, which helps me start the android emulator based on the name one of the avd names from the list, wait 2 seconds, and then run flutter.



      alias runflutter="emulator @$(avdmanager list avd | grep -m 1 -Po '(?<=Name:s).*'  ) &; sleep 2;  flutter run"


      Main reason that I'm sure that my problem is about that alias is, when I test with /usr/bin/time zsh -i -c exit
      Gives me this:



      2.27user 0.18system 0:01.07elapsed 228%CPU (0avgtext+0avgdata 141092maxresident)k
      0inputs+112outputs (0major+50607minor)pagefaults 0swaps


      If delete my alias the output of the same command



      0.24user 0.11system 0:00.35elapsed 100%CPU (0avgtext+0avgdata 16036maxresident)k
      0inputs+96outputs (0major+16089minor)pagefaults 0swaps


      What are my thoughts and done so far



      I thought that I've already flutter command, so maybe having an alias with the flutter keyword on it cause some indexing problems, not sure if indexing or something similar exists. So I have renamed my alias, nothing changed.



      My other theory is, since there is almost 2 second delay and 2.0 difference between the numbers before the 'user' in the output, I thought it might be about my sleep command in the alias. It's executed somehow. I've deleted sleep command from my alias but didn't help.










      share|improve this question














      I've added an alias and slowed down my zsh opening time. It opens but just hangs for extra 1 or 2 seconds to give me a prompt (or it starts typing my command without prompt before it, at the top of the shell)



      There is an another question about it, but it resulted in that slowing down is not about aliases.



      Do aliases slow down a shell's start?



      I have an alias, which helps me start the android emulator based on the name one of the avd names from the list, wait 2 seconds, and then run flutter.



      alias runflutter="emulator @$(avdmanager list avd | grep -m 1 -Po '(?<=Name:s).*'  ) &; sleep 2;  flutter run"


      Main reason that I'm sure that my problem is about that alias is, when I test with /usr/bin/time zsh -i -c exit
      Gives me this:



      2.27user 0.18system 0:01.07elapsed 228%CPU (0avgtext+0avgdata 141092maxresident)k
      0inputs+112outputs (0major+50607minor)pagefaults 0swaps


      If delete my alias the output of the same command



      0.24user 0.11system 0:00.35elapsed 100%CPU (0avgtext+0avgdata 16036maxresident)k
      0inputs+96outputs (0major+16089minor)pagefaults 0swaps


      What are my thoughts and done so far



      I thought that I've already flutter command, so maybe having an alias with the flutter keyword on it cause some indexing problems, not sure if indexing or something similar exists. So I have renamed my alias, nothing changed.



      My other theory is, since there is almost 2 second delay and 2.0 difference between the numbers before the 'user' in the output, I thought it might be about my sleep command in the alias. It's executed somehow. I've deleted sleep command from my alias but didn't help.







      linux shell zsh






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 31 at 2:45









      mirkancalmirkancal

      265




      265






















          1 Answer
          1






          active

          oldest

          votes


















          1















          alias runflutter="emulator @$(avdmanager list avd | grep -m 1 -Po '(?<=Name:s).*' ) &; sleep 2; flutter run"




          The bold part of this alias is being executed when you define the alias. Is that behavior you want? How long does that take to run?



          It's my gut feeling that you're sleeping for 2 seconds because you wanted to give avdmanager time to run. If so, you might like the results of



          setopt rcquotes
          alias runflutter='emulator @$(avdmanager list avd | grep -m 1 -Po ''(?<=Name:s).*'' ) &; sleep 2; flutter run'
          setopt norcquotes


          better.



          I would, in general, recommend the use of rcquotes, and not turning it off otherwise, because without rcquotes, the shortest way I know to quote a single quote in a single quoted string is an unwieldy '''. If you prefer, you could do that instead of the rcquotes thing, giving you



          alias runflutter='emulator @$(avdmanager list avd | grep -m 1 -Po '''(?<=Name:s).*''' ) &; sleep 2; flutter run'





          share|improve this answer


























          • That works and I'm satisfied with the results. Thank you so much! I've also test the /usr/bin/time zsh -i -c exit and results seem normal. And yes, with sleep, I want to give emulator time to set up before run the project with flutter run. However, I didn't understand why the bold part start being executed when I define it.

            – mirkancal
            Jan 31 at 4:50






          • 1





            When you use double quotes in zsh, bash, or ksh, $() gets evaluated immediately. I think there's other shells in that list, but I don't know for certain off the top of my head.

            – Ed Grimm
            Feb 2 at 1:36











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2fsuperuser.com%2fquestions%2f1400359%2falias-slowed-down-zsh%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















          alias runflutter="emulator @$(avdmanager list avd | grep -m 1 -Po '(?<=Name:s).*' ) &; sleep 2; flutter run"




          The bold part of this alias is being executed when you define the alias. Is that behavior you want? How long does that take to run?



          It's my gut feeling that you're sleeping for 2 seconds because you wanted to give avdmanager time to run. If so, you might like the results of



          setopt rcquotes
          alias runflutter='emulator @$(avdmanager list avd | grep -m 1 -Po ''(?<=Name:s).*'' ) &; sleep 2; flutter run'
          setopt norcquotes


          better.



          I would, in general, recommend the use of rcquotes, and not turning it off otherwise, because without rcquotes, the shortest way I know to quote a single quote in a single quoted string is an unwieldy '''. If you prefer, you could do that instead of the rcquotes thing, giving you



          alias runflutter='emulator @$(avdmanager list avd | grep -m 1 -Po '''(?<=Name:s).*''' ) &; sleep 2; flutter run'





          share|improve this answer


























          • That works and I'm satisfied with the results. Thank you so much! I've also test the /usr/bin/time zsh -i -c exit and results seem normal. And yes, with sleep, I want to give emulator time to set up before run the project with flutter run. However, I didn't understand why the bold part start being executed when I define it.

            – mirkancal
            Jan 31 at 4:50






          • 1





            When you use double quotes in zsh, bash, or ksh, $() gets evaluated immediately. I think there's other shells in that list, but I don't know for certain off the top of my head.

            – Ed Grimm
            Feb 2 at 1:36
















          1















          alias runflutter="emulator @$(avdmanager list avd | grep -m 1 -Po '(?<=Name:s).*' ) &; sleep 2; flutter run"




          The bold part of this alias is being executed when you define the alias. Is that behavior you want? How long does that take to run?



          It's my gut feeling that you're sleeping for 2 seconds because you wanted to give avdmanager time to run. If so, you might like the results of



          setopt rcquotes
          alias runflutter='emulator @$(avdmanager list avd | grep -m 1 -Po ''(?<=Name:s).*'' ) &; sleep 2; flutter run'
          setopt norcquotes


          better.



          I would, in general, recommend the use of rcquotes, and not turning it off otherwise, because without rcquotes, the shortest way I know to quote a single quote in a single quoted string is an unwieldy '''. If you prefer, you could do that instead of the rcquotes thing, giving you



          alias runflutter='emulator @$(avdmanager list avd | grep -m 1 -Po '''(?<=Name:s).*''' ) &; sleep 2; flutter run'





          share|improve this answer


























          • That works and I'm satisfied with the results. Thank you so much! I've also test the /usr/bin/time zsh -i -c exit and results seem normal. And yes, with sleep, I want to give emulator time to set up before run the project with flutter run. However, I didn't understand why the bold part start being executed when I define it.

            – mirkancal
            Jan 31 at 4:50






          • 1





            When you use double quotes in zsh, bash, or ksh, $() gets evaluated immediately. I think there's other shells in that list, but I don't know for certain off the top of my head.

            – Ed Grimm
            Feb 2 at 1:36














          1












          1








          1








          alias runflutter="emulator @$(avdmanager list avd | grep -m 1 -Po '(?<=Name:s).*' ) &; sleep 2; flutter run"




          The bold part of this alias is being executed when you define the alias. Is that behavior you want? How long does that take to run?



          It's my gut feeling that you're sleeping for 2 seconds because you wanted to give avdmanager time to run. If so, you might like the results of



          setopt rcquotes
          alias runflutter='emulator @$(avdmanager list avd | grep -m 1 -Po ''(?<=Name:s).*'' ) &; sleep 2; flutter run'
          setopt norcquotes


          better.



          I would, in general, recommend the use of rcquotes, and not turning it off otherwise, because without rcquotes, the shortest way I know to quote a single quote in a single quoted string is an unwieldy '''. If you prefer, you could do that instead of the rcquotes thing, giving you



          alias runflutter='emulator @$(avdmanager list avd | grep -m 1 -Po '''(?<=Name:s).*''' ) &; sleep 2; flutter run'





          share|improve this answer
















          alias runflutter="emulator @$(avdmanager list avd | grep -m 1 -Po '(?<=Name:s).*' ) &; sleep 2; flutter run"




          The bold part of this alias is being executed when you define the alias. Is that behavior you want? How long does that take to run?



          It's my gut feeling that you're sleeping for 2 seconds because you wanted to give avdmanager time to run. If so, you might like the results of



          setopt rcquotes
          alias runflutter='emulator @$(avdmanager list avd | grep -m 1 -Po ''(?<=Name:s).*'' ) &; sleep 2; flutter run'
          setopt norcquotes


          better.



          I would, in general, recommend the use of rcquotes, and not turning it off otherwise, because without rcquotes, the shortest way I know to quote a single quote in a single quoted string is an unwieldy '''. If you prefer, you could do that instead of the rcquotes thing, giving you



          alias runflutter='emulator @$(avdmanager list avd | grep -m 1 -Po '''(?<=Name:s).*''' ) &; sleep 2; flutter run'






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 31 at 4:01

























          answered Jan 31 at 3:55









          Ed GrimmEd Grimm

          1267




          1267













          • That works and I'm satisfied with the results. Thank you so much! I've also test the /usr/bin/time zsh -i -c exit and results seem normal. And yes, with sleep, I want to give emulator time to set up before run the project with flutter run. However, I didn't understand why the bold part start being executed when I define it.

            – mirkancal
            Jan 31 at 4:50






          • 1





            When you use double quotes in zsh, bash, or ksh, $() gets evaluated immediately. I think there's other shells in that list, but I don't know for certain off the top of my head.

            – Ed Grimm
            Feb 2 at 1:36



















          • That works and I'm satisfied with the results. Thank you so much! I've also test the /usr/bin/time zsh -i -c exit and results seem normal. And yes, with sleep, I want to give emulator time to set up before run the project with flutter run. However, I didn't understand why the bold part start being executed when I define it.

            – mirkancal
            Jan 31 at 4:50






          • 1





            When you use double quotes in zsh, bash, or ksh, $() gets evaluated immediately. I think there's other shells in that list, but I don't know for certain off the top of my head.

            – Ed Grimm
            Feb 2 at 1:36

















          That works and I'm satisfied with the results. Thank you so much! I've also test the /usr/bin/time zsh -i -c exit and results seem normal. And yes, with sleep, I want to give emulator time to set up before run the project with flutter run. However, I didn't understand why the bold part start being executed when I define it.

          – mirkancal
          Jan 31 at 4:50





          That works and I'm satisfied with the results. Thank you so much! I've also test the /usr/bin/time zsh -i -c exit and results seem normal. And yes, with sleep, I want to give emulator time to set up before run the project with flutter run. However, I didn't understand why the bold part start being executed when I define it.

          – mirkancal
          Jan 31 at 4:50




          1




          1





          When you use double quotes in zsh, bash, or ksh, $() gets evaluated immediately. I think there's other shells in that list, but I don't know for certain off the top of my head.

          – Ed Grimm
          Feb 2 at 1:36





          When you use double quotes in zsh, bash, or ksh, $() gets evaluated immediately. I think there's other shells in that list, but I don't know for certain off the top of my head.

          – Ed Grimm
          Feb 2 at 1:36


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • 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%2fsuperuser.com%2fquestions%2f1400359%2falias-slowed-down-zsh%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

          How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

          is 'sed' thread safe

          How to make a Squid Proxy server?