watch aliased cmd doesn't workMaking BASH script `for` handle filenames with spaces (or workaround)Why...

Difference on montgomery curve equation between EFD and RFC7748

Accepted offer letter, position changed

Distinction between apt-cache and dpkg -l

In the quantum hamiltonian, why does kinetic energy turn into an operator while potential doesn't?

Signed and unsigned numbers

Can Mathematica be used to create an Artistic 3D extrusion from a 2D image and wrap a line pattern around it?

Are babies of evil humanoid species inherently evil?

Could you please stop shuffling the deck and play already?

Does this video of collapsing warehouse shelves show a real incident?

Did Carol Danvers really receive a Kree blood tranfusion?

Virginia employer terminated employee and wants signing bonus returned

How did Alan Turing break the enigma code using the hint given by the lady in the bar?

Do f-stop and exposure time perfectly cancel?

Database Backup for data and log files

What's the "normal" opposite of flautando?

Should I take out a loan for a friend to invest on my behalf?

Why the color red for the Republican Party

Do items de-spawn in Diablo?

Does the nature of the Apocalypse in The Umbrella Academy change from the first to the last episode?

Am I not good enough for you?

How many characters using PHB rules does it take to be able to have access to any PHB spell at the start of an adventuring day?

Word for a person who has no opinion about whether god exists

Are tamper resistant receptacles really safer?

Was Luke Skywalker the leader of the Rebel forces on Hoth?



watch aliased cmd doesn't work


Making BASH script `for` handle filenames with spaces (or workaround)Why doesn't this script work?Source my bash profile when I su on OS XDoes “ulimit -Su” limit the number of user processes created in interactive login subshells and tmux sessions created therein?Linux Bash “|” operator doesn't work - what am I doing wrong?Unable to run tmux on OS XRun a remote script/application in detached mode in AnsibleCan ',,' be aliased to '..'?iTerm2: weird error message when I try to source a configuration file.inputrc bindings sporadically not working













0















When I do



$ watch kubectl get pods


it works fine but on doing:



$ alias p0="kubectl get pods"
$ watch p0


gives an error:
Every 2.0s: p0

sh: p0: command not found



It looks like watch is starting a subshell and the aliases in my current shell aren't visible to the subshell. I do have



$ shopt -s expand_aliases


at the very top of my .bashrc but it isn't helping.



Trying this with bash version 3.2.57 on Mac OS Mojave.










share|improve this question





























    0















    When I do



    $ watch kubectl get pods


    it works fine but on doing:



    $ alias p0="kubectl get pods"
    $ watch p0


    gives an error:
    Every 2.0s: p0

    sh: p0: command not found



    It looks like watch is starting a subshell and the aliases in my current shell aren't visible to the subshell. I do have



    $ shopt -s expand_aliases


    at the very top of my .bashrc but it isn't helping.



    Trying this with bash version 3.2.57 on Mac OS Mojave.










    share|improve this question



























      0












      0








      0








      When I do



      $ watch kubectl get pods


      it works fine but on doing:



      $ alias p0="kubectl get pods"
      $ watch p0


      gives an error:
      Every 2.0s: p0

      sh: p0: command not found



      It looks like watch is starting a subshell and the aliases in my current shell aren't visible to the subshell. I do have



      $ shopt -s expand_aliases


      at the very top of my .bashrc but it isn't helping.



      Trying this with bash version 3.2.57 on Mac OS Mojave.










      share|improve this question
















      When I do



      $ watch kubectl get pods


      it works fine but on doing:



      $ alias p0="kubectl get pods"
      $ watch p0


      gives an error:
      Every 2.0s: p0

      sh: p0: command not found



      It looks like watch is starting a subshell and the aliases in my current shell aren't visible to the subshell. I do have



      $ shopt -s expand_aliases


      at the very top of my .bashrc but it isn't helping.



      Trying this with bash version 3.2.57 on Mac OS Mojave.







      bash bash-scripting






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 17 mins ago







      user674669

















      asked 29 mins ago









      user674669user674669

      175215




      175215






















          0






          active

          oldest

          votes











          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%2f1413282%2fwatch-aliased-cmd-doesnt-work%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 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%2f1413282%2fwatch-aliased-cmd-doesnt-work%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

          Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

          Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...