Skip to main content
added 6 characters in body
Source Link
ilkkachu
  • 141.4k
  • 16
  • 249
  • 418

It's bash's extglob pattern matching syntax which it copied from the Korn shell (a subset thereof). !(pattern), when the extglob has been enabled one way or another (like via the bash_completion add-on in interactive shells) expands to the names of the (non-hidden by default) files in the current working directory that don't match pattern.

With an empty pattern, that's all files in the current directory whose name is not the empty string, but a file name cannot be empty anyway so that's all the (non-hidden by default) files.

You'll get the same in zsh with echo ^ when its extendedglob option is enabled where ^pattern is its equivalent of ksh's !(pattern).

It's bash's extglob pattern matching syntax which it copied from the Korn shell (a subset thereof). !(pattern), when the extglob has been enabled one way or another (like via the bash_completion add-on in interactive shells) expands to the names of the (non-hidden by default) files in the current working directory that don't match pattern.

With an empty pattern, that's all files in the current directory whose name is the empty string, but a file name cannot be empty anyway so that's all the (non-hidden by default) files.

You'll get the same in zsh with echo ^ when its extendedglob option is enabled where ^pattern is its equivalent of ksh's !(pattern).

It's bash's extglob pattern matching syntax which it copied from the Korn shell (a subset thereof). !(pattern), when the extglob has been enabled one way or another (like via the bash_completion add-on in interactive shells) expands to the names of the (non-hidden by default) files in the current working directory that don't match pattern.

With an empty pattern, that's all files in the current directory whose name is not the empty string, but a file name cannot be empty anyway so that's all the (non-hidden by default) files.

You'll get the same in zsh with echo ^ when its extendedglob option is enabled where ^pattern is its equivalent of ksh's !(pattern).

added 518 characters in body
Source Link
Stéphane Chazelas
  • 553.6k
  • 92
  • 1.1k
  • 1.6k

It's bash's extglob pattern matching syntax which it copied from the Korn shell (a subset thereof). !(pattern) matches, when the extglob has been enabled one way or another (like via the bash_completion add-on in interactive shells) expands to the names of the (non-hidden by default) files in the current working directory that don't match pattern. 

With an empty pattern, that's all files in the current directory whose name is the empty string, but a file name cannot be empty anyway so that's all the (non-hidden by default) files.

You'll get the same in zsh with echo ^ when its extendedglob option is enabled where ^pattern is its equivalent of ksh's !(pattern).

It's bash's extglob pattern matching syntax. !(pattern) matches files that don't match pattern. With an empty pattern, that's all files in the current directory.

It's bash's extglob pattern matching syntax which it copied from the Korn shell (a subset thereof). !(pattern), when the extglob has been enabled one way or another (like via the bash_completion add-on in interactive shells) expands to the names of the (non-hidden by default) files in the current working directory that don't match pattern. 

With an empty pattern, that's all files in the current directory whose name is the empty string, but a file name cannot be empty anyway so that's all the (non-hidden by default) files.

You'll get the same in zsh with echo ^ when its extendedglob option is enabled where ^pattern is its equivalent of ksh's !(pattern).

Source Link
Shawn
  • 1.4k
  • 7
  • 9

It's bash's extglob pattern matching syntax. !(pattern) matches files that don't match pattern. With an empty pattern, that's all files in the current directory.