You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the inclusion of tab completion in #30 the expansion of filenames by the shell using the asterisk * wild card may additionally included.
The asterisk * matches everything in the current directory (excluding ./, ../, and any filename starting with a period, e.g. .bashrc) or the greatest possible match with the pattern given before or after it. This way, may similar files can be acted upon using only one command.
Example
Suppose there are several files in the current directory. Some are Python scripts ending in .py, some are folders (indicated below with a trailing forward slash /) starting with 001- in their filename, and others match neither of these two requirements. A file listing may show:
Suppose all folders starting with 001- are to be deleted retainig the results folder, all Python scripts copied one folder up, and all other files left untouched.
This can be acieved with two commands:
rm -r 001-*/
cp *.py ../
In the first line any file with a filename starting with 001- and also ending with a / (identifying it as directory) is deleted.
The second line matches any file with a filename ending in .py.
The example listing after execution of the two commands is
Shell Globbing
After the inclusion of tab completion in #30 the expansion of filenames by the shell using the asterisk
*
wild card may additionally included.The asterisk
*
matches everything in the current directory (excluding./
,../
, and any filename starting with a period, e.g..bashrc
) or the greatest possible match with the pattern given before or after it. This way, may similar files can be acted upon using only one command.Example
Suppose there are several files in the current directory. Some are Python scripts ending in
.py
, some are folders (indicated below with a trailing forward slash/
) starting with001-
in their filename, and others match neither of these two requirements. A file listing may show:Suppose all folders starting with
001-
are to be deleted retainig theresults
folder, all Python scripts copied one folder up, and all other files left untouched.This can be acieved with two commands:
In the first line any file with a filename starting with
001-
and also ending with a/
(identifying it as directory) is deleted.The second line matches any file with a filename ending in
.py
.The example listing after execution of the two commands is
with only the undesired folders removed and the Python scripts also available in the folder above the current one.
The text was updated successfully, but these errors were encountered: