Portable check empty directory












5














With Bash and Dash, you can check for an empty directory using just the shell
(ignore dotfiles to keep things simple):



set *
if [ -e "$1" ]
then
echo 'not empty'
else
echo 'empty'
fi


However I recently learned that Zsh fails spectacularly in this case:



% set *
zsh: no matches found: *

% echo "$? $#"
1 0


So not only does the set command fail, but it doesn't even set $@. I suppose
I could test if $# is 0, but it appears that Zsh even stops execution:



% { set *; echo 2; }
zsh: no matches found: *


Compare with Bash and Dash:



$ { set *; echo 2; }
2


Can this be done in a way that works in bash, dash and zsh?










share|improve this question









New contributor




Three is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    5














    With Bash and Dash, you can check for an empty directory using just the shell
    (ignore dotfiles to keep things simple):



    set *
    if [ -e "$1" ]
    then
    echo 'not empty'
    else
    echo 'empty'
    fi


    However I recently learned that Zsh fails spectacularly in this case:



    % set *
    zsh: no matches found: *

    % echo "$? $#"
    1 0


    So not only does the set command fail, but it doesn't even set $@. I suppose
    I could test if $# is 0, but it appears that Zsh even stops execution:



    % { set *; echo 2; }
    zsh: no matches found: *


    Compare with Bash and Dash:



    $ { set *; echo 2; }
    2


    Can this be done in a way that works in bash, dash and zsh?










    share|improve this question









    New contributor




    Three is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      5












      5








      5







      With Bash and Dash, you can check for an empty directory using just the shell
      (ignore dotfiles to keep things simple):



      set *
      if [ -e "$1" ]
      then
      echo 'not empty'
      else
      echo 'empty'
      fi


      However I recently learned that Zsh fails spectacularly in this case:



      % set *
      zsh: no matches found: *

      % echo "$? $#"
      1 0


      So not only does the set command fail, but it doesn't even set $@. I suppose
      I could test if $# is 0, but it appears that Zsh even stops execution:



      % { set *; echo 2; }
      zsh: no matches found: *


      Compare with Bash and Dash:



      $ { set *; echo 2; }
      2


      Can this be done in a way that works in bash, dash and zsh?










      share|improve this question









      New contributor




      Three is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      With Bash and Dash, you can check for an empty directory using just the shell
      (ignore dotfiles to keep things simple):



      set *
      if [ -e "$1" ]
      then
      echo 'not empty'
      else
      echo 'empty'
      fi


      However I recently learned that Zsh fails spectacularly in this case:



      % set *
      zsh: no matches found: *

      % echo "$? $#"
      1 0


      So not only does the set command fail, but it doesn't even set $@. I suppose
      I could test if $# is 0, but it appears that Zsh even stops execution:



      % { set *; echo 2; }
      zsh: no matches found: *


      Compare with Bash and Dash:



      $ { set *; echo 2; }
      2


      Can this be done in a way that works in bash, dash and zsh?







      bash zsh wildcards portability dash






      share|improve this question









      New contributor




      Three is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Three is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 2 hours ago









      terdon

      128k31252427




      128k31252427






      New contributor




      Three is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 hours ago









      Three

      262




      262




      New contributor




      Three is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Three is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Three is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes


















          3














          While zsh's default behaviour is to give an error, this is controlled by the nomatch option. You can unset the option to leave the * in place the way that bash and dash do:



          setopt -o nonomatch


          While that command won't work in either of the others, you can just ignore that:



          setopt -o nonomatch 2>/dev/null || true ; set *


          This runs setopt on zsh, and suppresses the error output (2>/dev/null) and return code (|| true) of the failed command on the others.



          As written it's problematic if there is a file, for example, -e: then you will run set -e and change the shell options to terminate whenever a command fails; there are worse outcomes if you're creative. set -- * will be safer and prevent the option changes.






          share|improve this answer























          • If a file is named *, then $1 equals * and [ -e "$1" ] passes, meaning the example in the question still works
            – Three
            1 hour ago










          • @Three Fair point! It's conceptually iffy but it does actually work, since if there is a file there then... there is a file there.
            – Michael Homer
            1 hour ago



















          3














          Most portable way would be via set and globstar for all POSIX-compliant shells. This has been shown in Gilles's answer on a related question. I've adapted the method slightly into a function:



          rm -rf empty_dir/
          mkdir empty_dir/
          pwd
          cd empty_dir/
          pwd
          dir_empty(){

          # https://stackoverflow.com/a/9911082/3701431
          if [ -n "$ZSH_VERSION" ]; then
          # https://unix.stackexchange.com/a/310553/85039
          setopt +o nomatch
          fi

          set -- * .*
          echo "$@"
          for i; do
          [ "$i" = "." ] || [ "$i" = ".." ] && continue
          [ -e "$i" ] && echo "Not empty" && return 1
          done
          echo "Empty" && return 0
          }
          dir_empty
          touch '*'
          dir_empty


          The big problem with zsh is that while ksh and bash behave in more or less consistent manner - that is when we do set * .* you will have 3 positional parameters * . .. in really empty directory - in zsh you will get * .* as positional parameters. Luckily at least for i ; do ... done to iterate over positional parameters works consistently. The rest is just iteration and check for existence of the filename, with . and .. skipped.





          Try it online in ksh!



          Try it online in zsh!






          share|improve this answer























          • @Three I've adapted the answer to check for zsh. Unfortunatelly for us zsh decided to go the weird way instead of similar behavior to bash or other shells, since according to POSIX: "If the pattern does not match any pathnames, the returned number of matched paths is set to 0, and the contents of pglob->gl_pathv are implementation-defined." source
            – Sergiy Kolodyazhnyy
            1 hour ago










          • turning nomatch everywhere risks breaking code that assumes the default (and very sensible) setting that sh and bash get wrong, so the change really should be localized only to this function
            – thrig
            29 mins ago










          • @thrig Well, considering that so far others haven't found a way to make glob work without nomatch, that's the best we got. We can also toggle it back before function exits, of course. Or we could just abandon shell ways and just use something else, like find for instance.
            – Sergiy Kolodyazhnyy
            14 mins ago










          • @Three I've revised the answer again. Probably this is the best I can do, as zsh seems to favor features instead of consistency. Hope this helps somewhat.
            – Sergiy Kolodyazhnyy
            13 mins ago










          • @SergiyKolodyazhnyy yes thanks - I would just avoid Zsh totally but its used on Manjaro - maybe I will avoid that too :)
            – Three
            10 mins ago











          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
          });


          }
          });






          Three is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f492912%2fportable-check-empty-directory%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          While zsh's default behaviour is to give an error, this is controlled by the nomatch option. You can unset the option to leave the * in place the way that bash and dash do:



          setopt -o nonomatch


          While that command won't work in either of the others, you can just ignore that:



          setopt -o nonomatch 2>/dev/null || true ; set *


          This runs setopt on zsh, and suppresses the error output (2>/dev/null) and return code (|| true) of the failed command on the others.



          As written it's problematic if there is a file, for example, -e: then you will run set -e and change the shell options to terminate whenever a command fails; there are worse outcomes if you're creative. set -- * will be safer and prevent the option changes.






          share|improve this answer























          • If a file is named *, then $1 equals * and [ -e "$1" ] passes, meaning the example in the question still works
            – Three
            1 hour ago










          • @Three Fair point! It's conceptually iffy but it does actually work, since if there is a file there then... there is a file there.
            – Michael Homer
            1 hour ago
















          3














          While zsh's default behaviour is to give an error, this is controlled by the nomatch option. You can unset the option to leave the * in place the way that bash and dash do:



          setopt -o nonomatch


          While that command won't work in either of the others, you can just ignore that:



          setopt -o nonomatch 2>/dev/null || true ; set *


          This runs setopt on zsh, and suppresses the error output (2>/dev/null) and return code (|| true) of the failed command on the others.



          As written it's problematic if there is a file, for example, -e: then you will run set -e and change the shell options to terminate whenever a command fails; there are worse outcomes if you're creative. set -- * will be safer and prevent the option changes.






          share|improve this answer























          • If a file is named *, then $1 equals * and [ -e "$1" ] passes, meaning the example in the question still works
            – Three
            1 hour ago










          • @Three Fair point! It's conceptually iffy but it does actually work, since if there is a file there then... there is a file there.
            – Michael Homer
            1 hour ago














          3












          3








          3






          While zsh's default behaviour is to give an error, this is controlled by the nomatch option. You can unset the option to leave the * in place the way that bash and dash do:



          setopt -o nonomatch


          While that command won't work in either of the others, you can just ignore that:



          setopt -o nonomatch 2>/dev/null || true ; set *


          This runs setopt on zsh, and suppresses the error output (2>/dev/null) and return code (|| true) of the failed command on the others.



          As written it's problematic if there is a file, for example, -e: then you will run set -e and change the shell options to terminate whenever a command fails; there are worse outcomes if you're creative. set -- * will be safer and prevent the option changes.






          share|improve this answer














          While zsh's default behaviour is to give an error, this is controlled by the nomatch option. You can unset the option to leave the * in place the way that bash and dash do:



          setopt -o nonomatch


          While that command won't work in either of the others, you can just ignore that:



          setopt -o nonomatch 2>/dev/null || true ; set *


          This runs setopt on zsh, and suppresses the error output (2>/dev/null) and return code (|| true) of the failed command on the others.



          As written it's problematic if there is a file, for example, -e: then you will run set -e and change the shell options to terminate whenever a command fails; there are worse outcomes if you're creative. set -- * will be safer and prevent the option changes.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 1 hour ago

























          answered 1 hour ago









          Michael Homer

          46.3k8121161




          46.3k8121161












          • If a file is named *, then $1 equals * and [ -e "$1" ] passes, meaning the example in the question still works
            – Three
            1 hour ago










          • @Three Fair point! It's conceptually iffy but it does actually work, since if there is a file there then... there is a file there.
            – Michael Homer
            1 hour ago


















          • If a file is named *, then $1 equals * and [ -e "$1" ] passes, meaning the example in the question still works
            – Three
            1 hour ago










          • @Three Fair point! It's conceptually iffy but it does actually work, since if there is a file there then... there is a file there.
            – Michael Homer
            1 hour ago
















          If a file is named *, then $1 equals * and [ -e "$1" ] passes, meaning the example in the question still works
          – Three
          1 hour ago




          If a file is named *, then $1 equals * and [ -e "$1" ] passes, meaning the example in the question still works
          – Three
          1 hour ago












          @Three Fair point! It's conceptually iffy but it does actually work, since if there is a file there then... there is a file there.
          – Michael Homer
          1 hour ago




          @Three Fair point! It's conceptually iffy but it does actually work, since if there is a file there then... there is a file there.
          – Michael Homer
          1 hour ago













          3














          Most portable way would be via set and globstar for all POSIX-compliant shells. This has been shown in Gilles's answer on a related question. I've adapted the method slightly into a function:



          rm -rf empty_dir/
          mkdir empty_dir/
          pwd
          cd empty_dir/
          pwd
          dir_empty(){

          # https://stackoverflow.com/a/9911082/3701431
          if [ -n "$ZSH_VERSION" ]; then
          # https://unix.stackexchange.com/a/310553/85039
          setopt +o nomatch
          fi

          set -- * .*
          echo "$@"
          for i; do
          [ "$i" = "." ] || [ "$i" = ".." ] && continue
          [ -e "$i" ] && echo "Not empty" && return 1
          done
          echo "Empty" && return 0
          }
          dir_empty
          touch '*'
          dir_empty


          The big problem with zsh is that while ksh and bash behave in more or less consistent manner - that is when we do set * .* you will have 3 positional parameters * . .. in really empty directory - in zsh you will get * .* as positional parameters. Luckily at least for i ; do ... done to iterate over positional parameters works consistently. The rest is just iteration and check for existence of the filename, with . and .. skipped.





          Try it online in ksh!



          Try it online in zsh!






          share|improve this answer























          • @Three I've adapted the answer to check for zsh. Unfortunatelly for us zsh decided to go the weird way instead of similar behavior to bash or other shells, since according to POSIX: "If the pattern does not match any pathnames, the returned number of matched paths is set to 0, and the contents of pglob->gl_pathv are implementation-defined." source
            – Sergiy Kolodyazhnyy
            1 hour ago










          • turning nomatch everywhere risks breaking code that assumes the default (and very sensible) setting that sh and bash get wrong, so the change really should be localized only to this function
            – thrig
            29 mins ago










          • @thrig Well, considering that so far others haven't found a way to make glob work without nomatch, that's the best we got. We can also toggle it back before function exits, of course. Or we could just abandon shell ways and just use something else, like find for instance.
            – Sergiy Kolodyazhnyy
            14 mins ago










          • @Three I've revised the answer again. Probably this is the best I can do, as zsh seems to favor features instead of consistency. Hope this helps somewhat.
            – Sergiy Kolodyazhnyy
            13 mins ago










          • @SergiyKolodyazhnyy yes thanks - I would just avoid Zsh totally but its used on Manjaro - maybe I will avoid that too :)
            – Three
            10 mins ago
















          3














          Most portable way would be via set and globstar for all POSIX-compliant shells. This has been shown in Gilles's answer on a related question. I've adapted the method slightly into a function:



          rm -rf empty_dir/
          mkdir empty_dir/
          pwd
          cd empty_dir/
          pwd
          dir_empty(){

          # https://stackoverflow.com/a/9911082/3701431
          if [ -n "$ZSH_VERSION" ]; then
          # https://unix.stackexchange.com/a/310553/85039
          setopt +o nomatch
          fi

          set -- * .*
          echo "$@"
          for i; do
          [ "$i" = "." ] || [ "$i" = ".." ] && continue
          [ -e "$i" ] && echo "Not empty" && return 1
          done
          echo "Empty" && return 0
          }
          dir_empty
          touch '*'
          dir_empty


          The big problem with zsh is that while ksh and bash behave in more or less consistent manner - that is when we do set * .* you will have 3 positional parameters * . .. in really empty directory - in zsh you will get * .* as positional parameters. Luckily at least for i ; do ... done to iterate over positional parameters works consistently. The rest is just iteration and check for existence of the filename, with . and .. skipped.





          Try it online in ksh!



          Try it online in zsh!






          share|improve this answer























          • @Three I've adapted the answer to check for zsh. Unfortunatelly for us zsh decided to go the weird way instead of similar behavior to bash or other shells, since according to POSIX: "If the pattern does not match any pathnames, the returned number of matched paths is set to 0, and the contents of pglob->gl_pathv are implementation-defined." source
            – Sergiy Kolodyazhnyy
            1 hour ago










          • turning nomatch everywhere risks breaking code that assumes the default (and very sensible) setting that sh and bash get wrong, so the change really should be localized only to this function
            – thrig
            29 mins ago










          • @thrig Well, considering that so far others haven't found a way to make glob work without nomatch, that's the best we got. We can also toggle it back before function exits, of course. Or we could just abandon shell ways and just use something else, like find for instance.
            – Sergiy Kolodyazhnyy
            14 mins ago










          • @Three I've revised the answer again. Probably this is the best I can do, as zsh seems to favor features instead of consistency. Hope this helps somewhat.
            – Sergiy Kolodyazhnyy
            13 mins ago










          • @SergiyKolodyazhnyy yes thanks - I would just avoid Zsh totally but its used on Manjaro - maybe I will avoid that too :)
            – Three
            10 mins ago














          3












          3








          3






          Most portable way would be via set and globstar for all POSIX-compliant shells. This has been shown in Gilles's answer on a related question. I've adapted the method slightly into a function:



          rm -rf empty_dir/
          mkdir empty_dir/
          pwd
          cd empty_dir/
          pwd
          dir_empty(){

          # https://stackoverflow.com/a/9911082/3701431
          if [ -n "$ZSH_VERSION" ]; then
          # https://unix.stackexchange.com/a/310553/85039
          setopt +o nomatch
          fi

          set -- * .*
          echo "$@"
          for i; do
          [ "$i" = "." ] || [ "$i" = ".." ] && continue
          [ -e "$i" ] && echo "Not empty" && return 1
          done
          echo "Empty" && return 0
          }
          dir_empty
          touch '*'
          dir_empty


          The big problem with zsh is that while ksh and bash behave in more or less consistent manner - that is when we do set * .* you will have 3 positional parameters * . .. in really empty directory - in zsh you will get * .* as positional parameters. Luckily at least for i ; do ... done to iterate over positional parameters works consistently. The rest is just iteration and check for existence of the filename, with . and .. skipped.





          Try it online in ksh!



          Try it online in zsh!






          share|improve this answer














          Most portable way would be via set and globstar for all POSIX-compliant shells. This has been shown in Gilles's answer on a related question. I've adapted the method slightly into a function:



          rm -rf empty_dir/
          mkdir empty_dir/
          pwd
          cd empty_dir/
          pwd
          dir_empty(){

          # https://stackoverflow.com/a/9911082/3701431
          if [ -n "$ZSH_VERSION" ]; then
          # https://unix.stackexchange.com/a/310553/85039
          setopt +o nomatch
          fi

          set -- * .*
          echo "$@"
          for i; do
          [ "$i" = "." ] || [ "$i" = ".." ] && continue
          [ -e "$i" ] && echo "Not empty" && return 1
          done
          echo "Empty" && return 0
          }
          dir_empty
          touch '*'
          dir_empty


          The big problem with zsh is that while ksh and bash behave in more or less consistent manner - that is when we do set * .* you will have 3 positional parameters * . .. in really empty directory - in zsh you will get * .* as positional parameters. Luckily at least for i ; do ... done to iterate over positional parameters works consistently. The rest is just iteration and check for existence of the filename, with . and .. skipped.





          Try it online in ksh!



          Try it online in zsh!







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 17 mins ago

























          answered 1 hour ago









          Sergiy Kolodyazhnyy

          8,39212152




          8,39212152












          • @Three I've adapted the answer to check for zsh. Unfortunatelly for us zsh decided to go the weird way instead of similar behavior to bash or other shells, since according to POSIX: "If the pattern does not match any pathnames, the returned number of matched paths is set to 0, and the contents of pglob->gl_pathv are implementation-defined." source
            – Sergiy Kolodyazhnyy
            1 hour ago










          • turning nomatch everywhere risks breaking code that assumes the default (and very sensible) setting that sh and bash get wrong, so the change really should be localized only to this function
            – thrig
            29 mins ago










          • @thrig Well, considering that so far others haven't found a way to make glob work without nomatch, that's the best we got. We can also toggle it back before function exits, of course. Or we could just abandon shell ways and just use something else, like find for instance.
            – Sergiy Kolodyazhnyy
            14 mins ago










          • @Three I've revised the answer again. Probably this is the best I can do, as zsh seems to favor features instead of consistency. Hope this helps somewhat.
            – Sergiy Kolodyazhnyy
            13 mins ago










          • @SergiyKolodyazhnyy yes thanks - I would just avoid Zsh totally but its used on Manjaro - maybe I will avoid that too :)
            – Three
            10 mins ago


















          • @Three I've adapted the answer to check for zsh. Unfortunatelly for us zsh decided to go the weird way instead of similar behavior to bash or other shells, since according to POSIX: "If the pattern does not match any pathnames, the returned number of matched paths is set to 0, and the contents of pglob->gl_pathv are implementation-defined." source
            – Sergiy Kolodyazhnyy
            1 hour ago










          • turning nomatch everywhere risks breaking code that assumes the default (and very sensible) setting that sh and bash get wrong, so the change really should be localized only to this function
            – thrig
            29 mins ago










          • @thrig Well, considering that so far others haven't found a way to make glob work without nomatch, that's the best we got. We can also toggle it back before function exits, of course. Or we could just abandon shell ways and just use something else, like find for instance.
            – Sergiy Kolodyazhnyy
            14 mins ago










          • @Three I've revised the answer again. Probably this is the best I can do, as zsh seems to favor features instead of consistency. Hope this helps somewhat.
            – Sergiy Kolodyazhnyy
            13 mins ago










          • @SergiyKolodyazhnyy yes thanks - I would just avoid Zsh totally but its used on Manjaro - maybe I will avoid that too :)
            – Three
            10 mins ago
















          @Three I've adapted the answer to check for zsh. Unfortunatelly for us zsh decided to go the weird way instead of similar behavior to bash or other shells, since according to POSIX: "If the pattern does not match any pathnames, the returned number of matched paths is set to 0, and the contents of pglob->gl_pathv are implementation-defined." source
          – Sergiy Kolodyazhnyy
          1 hour ago




          @Three I've adapted the answer to check for zsh. Unfortunatelly for us zsh decided to go the weird way instead of similar behavior to bash or other shells, since according to POSIX: "If the pattern does not match any pathnames, the returned number of matched paths is set to 0, and the contents of pglob->gl_pathv are implementation-defined." source
          – Sergiy Kolodyazhnyy
          1 hour ago












          turning nomatch everywhere risks breaking code that assumes the default (and very sensible) setting that sh and bash get wrong, so the change really should be localized only to this function
          – thrig
          29 mins ago




          turning nomatch everywhere risks breaking code that assumes the default (and very sensible) setting that sh and bash get wrong, so the change really should be localized only to this function
          – thrig
          29 mins ago












          @thrig Well, considering that so far others haven't found a way to make glob work without nomatch, that's the best we got. We can also toggle it back before function exits, of course. Or we could just abandon shell ways and just use something else, like find for instance.
          – Sergiy Kolodyazhnyy
          14 mins ago




          @thrig Well, considering that so far others haven't found a way to make glob work without nomatch, that's the best we got. We can also toggle it back before function exits, of course. Or we could just abandon shell ways and just use something else, like find for instance.
          – Sergiy Kolodyazhnyy
          14 mins ago












          @Three I've revised the answer again. Probably this is the best I can do, as zsh seems to favor features instead of consistency. Hope this helps somewhat.
          – Sergiy Kolodyazhnyy
          13 mins ago




          @Three I've revised the answer again. Probably this is the best I can do, as zsh seems to favor features instead of consistency. Hope this helps somewhat.
          – Sergiy Kolodyazhnyy
          13 mins ago












          @SergiyKolodyazhnyy yes thanks - I would just avoid Zsh totally but its used on Manjaro - maybe I will avoid that too :)
          – Three
          10 mins ago




          @SergiyKolodyazhnyy yes thanks - I would just avoid Zsh totally but its used on Manjaro - maybe I will avoid that too :)
          – Three
          10 mins ago










          Three is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Three is a new contributor. Be nice, and check out our Code of Conduct.













          Three is a new contributor. Be nice, and check out our Code of Conduct.












          Three is a new contributor. Be nice, and check out our Code of Conduct.
















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f492912%2fportable-check-empty-directory%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

          Plaza Victoria

          In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

          How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...