dcli
  • Introduction
  • What does DCli do?
  • Install DCli
    • Installing on Windows
  • Writing your first CLI app
  • Add DCli to your project
  • pub.dev
  • github
  • Dart basics
    • Dart lambda functions
    • Function Arguments
    • Futures
    • stdin/stdout/stderr a primer
  • Tour
    • Overview
    • Using DCli functions
    • User input
      • Ask Validators
    • Displaying information
    • Managing Files And Directories
    • Environment variables
    • Calling apps
    • Redirecting output
    • Command Line Arguments
    • Paths
    • Glob Expansion
    • Piping
    • Locking
    • Fetch
    • The evils of CD
    • Assets/Resources
    • Cross Platform
      • Posix
      • Windows
      • Docker
        • Detecting Docker
        • Add DCli to a Docker Container
        • Example DCli app in Docker
  • Elevated Privileges
    • Sudo
  • Performance
  • Dependency Management
    • Dependency Management
    • Pubspec Managment
  • DCli Tools
    • DCli tools
    • Use a shebang #!
    • DCli Compile
    • DCli Clean
    • DCli Create
    • DCli Doctor
    • DCli Install
    • DCli Run
    • DCli Warmup
    • DCli Pack
    • Upgrade DCli
  • Internal Workings
    • Internal Workings
    • waitForEx
  • Contributing
    • Creating a release
    • Running Unit tests
    • Implemention support for a shell
    • Templates
  • References
  • Examples
    • Projects
    • Code
      • hello world.
      • dcompress
      • dpath
      • dmysql
      • dshell
      • dwhich
      • dipaddr
      • gnome launcher
  • Articles
    • build CLI apps in dart - part 1
    • build CLI apps in dart - part 2
    • Dealing with permissions
    • 3rd Party console packages
  • Dart on Linux - the perfect CLI tooling
  • Improving your build environment
    • Existing tooling
    • Building with Dart
    • A home for your build tools
  • Olivier Revial - CLI apps made easy
  • Video: package of the week
Powered by GitBook
On this page

Was this helpful?

  1. Tour

Glob Expansion

Glob Expansion refers to the expansion of wildcards (*.txt) into a list of files.

When you type a command such as 'ls *.txt' the shell expands the '*.txt' wildcard (referred to as a glob) to a list of files that match the given wildcard.

As a result of Glob expansion the 'ls' command receives a list of files that end in *.txt rather than the original glob.

If no files match the glob then the 'ls' command receives the actual glob '*.txt'.

Glob Expansion does not occur on Windows as neither PowerShell nor Command do glob expansion.

Glob expansion is sometimes undesirable. A classic example of this is the linux find command:

find / -name "*.txt"

If the '*.txt' glob was expanded then the find command would be passed a list of files in the current directory which is clearly not the intent. By wrapping the glob with quotes you are telling bash not to expand the glob but to pass '*.txt' directly to the find command so it can process the glob against each directory it visits.

DCli uses the same process. If you encase a glob in quotes then DCli will not expand the glob.

'find / -name "*.dart"'.run;

In the above example DCli sees that the glob is wrapped in quotes and as such passes the glob to find without first expanding it.

PreviousPathsNextPiping

Last updated 2 years ago

Was this helpful?