I am trying to create custom shell as an exercise and wanted to implement wildcard expansion. How exactly do shells like bash perform the expansion? I mean what all steps are involved?
As I understand, the shell looks for file names in the current directory and replaces the argument which contains the '*' with the filenames which should match. Is this correct? What other wildcard expansions should a shell do other than a '*'
The POSIX specification describes the word expansions that POSIX-compliant shells should support. You can use the glob or wordexp POSIX functions to perform these expansions (glob supports only a small subset of the expansions that wordexp supports).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With