I have a book that says that the output of the command
echo * is the line that follows below. I can't find why it outputs that. Please help.
$ echo * local.cshrc local.login local.profile
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
* is shell special character (glob match) that matches the names of files and directories in the current directory.
$ ls *
This will list all files and directories in current directory. So, in your case '*' returns and 'echo' prints them on the console. Try this to confirm:
$ x=* $ echo $x
You are using a wildcard -
* which is used with
The referenced link above describes this further:
Standard wildcards (also known as globbing patterns) are used by various command-line utilities to work with multiple files. For more information on standard wildcards (globbing patterns) refer to the manual page by typing:
*(asterisk) this can represent any number of characters (including zero, in other words, zero or more characters). If you specified a "cd*" it would use "cda", "cdrom", "cdrecord" and anything that starts with “cd” also including “cd” itself. "m*l" could by mill, mull, ml, and anything that starts with an m and ends with an l.