1

I have multiple shells (bash) open on the same machine, and in one of them, globbing seems to have stopped. ls * gives ls: *: No such file or directory, and so on. I figured that I must have set some glob options by mistake, but shopt | grep glob gives

dotglob         off
extglob         off
failglob        off
nocaseglob      off
nullglob        off

the same as in my other shells. What could be causing this?

0

If your current directory is empty, the * pattern will not match anything. In this case, since nullglob is off, the * string is not replaced and you're asking ls to list the file named "*". If you want the pattern to be replaced by an empty string when it does not match anything, use shopt -s nullglob

  • The directory has files in it. I'm seeing this behavior with '*' expansion in every directory in this shell. – pythonic metaphor Jul 17 '14 at 16:05
  • unset GLOBIGNORE? – Cyrus Jul 17 '14 at 16:14
  • @Cyrus tired unset GLOBIGNORE, still the same – pythonic metaphor Jul 17 '14 at 16:26
  • 1
    What is "ls"? Do type -a ls – glenn jackman Jul 17 '14 at 17:00
  • set +f to reenable globbing? – Cyrus Jul 19 '14 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.