A
A
Abdula Magomedov2015-12-30 00:21:39
linux
Abdula Magomedov, 2015-12-30 00:21:39

What happens when you type an asterisk (*) into a unix terminal?

Hey!
Who will explain normally, or give a link where it is described. What happens when you enter the command (*) in linux.
As I understand it, it takes all the files in a row and executes them in a row. There only names of files are considered? Or somehow the content also affects something. How does it all work?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
abcd0x00, 2015-12-30
@abcd0x00

If the shell encounters the character *, then it treats it as a wildcard character.
If it is a pattern character, then it takes the characters around it, making up the pattern.
When the template is composed, it takes all the names in the current directory in order and compares against this template.
All names that match the pattern are inserted with a space instead of the pattern.
And then the whole thing gets done.
That's an example

[[email protected] t]$ ls
[[email protected] t]$ touch cat
[[email protected] t]$ echo hello >file.txt
[[email protected] t]$ ll
итого 4
-rw-rw-r--. 1 guest guest 0 дек 30 11:32 cat
-rw-rw-r--. 1 guest guest 6 дек 30 11:32 file.txt
[[email protected] t]$ *
hello
[[email protected] t]$

O
Oleg Tsilyurik, 2015-12-30
@Olej

What happens when you enter the command (*) in linux.

Actually, there is no such command in Linux , and no such special characters are allowed as part of the command .
What you say applies to command parameters , and even then not to everyone.
Distinguish between a command , command options, and command line options ...otherwise you'll create confusion for yourself.

A
amatory10, 2015-12-30
@amatory10

yes * replaces the full name, eg rm *.txt will delete all files with .txt extension,
is there more like ? which replaces only one character e.g. ?ello i.e. will delete all files whose first character is arbitrary, and the rest, respectively, ello.

A
Antony, 2015-12-30
@RiseOfDeath

This is a normal regexp.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question