Parameter Expansion

Shell expands several characters provided in the command line.

  • Most important: *

  • Replaced by all files in the current scope.

  • Usage: ls *

What people think that it does: list all files.

What it does: list a list of filenames provided by bash.

  • Asterisk is converted to the effective name of the files

$ ls *
File.txt
$ touch -- '-la’
$ ls
-la file.txt
$ ls *
-rwxr-xr-x 1 user user 455584 Nov 5 23:36 file.txt

The * is the last command call that will be expanded to all files and the command will be transformed into ls -la file.txt.

Last updated