ch4 wildcards

Many (although not all) commands interpret two dashes (-- )
as indicating the end of the set of flags to the command itself, and the start of the list of filenames
to operate on. So rm -- “-rf .“ will remove the file “-rf ”

-----------

[a-z] is equivalent to [[:alpha:]], and [0-9] is equivalent to [[:digit:]]
Class Members
Alnum A-Z, a-z, 0-9
Alpha A-Z, a-z
Digit 0-9
Upper A-Z

The bash shell does offer more powerful wildcard explansion than the standard Bourne shell
-----------
Sometimes you might want to disable filename expansion completely; the bash directive set -o
noglob (alternatively set -f) disables it, and set +o noglob (or set +f) re-enables it.
$ touch *d*.odt
-----------
Setting the failglob option means that the shell itself will treat the use of a nonmatching expression as a shell error

$ shopt failglob
failglob off
$ ls b*
ls: cannot access b*: No such file or directory
-----------
sed has the -i option which updates the file in place
sed s/FROM/TO/g tfile -i
-----------
1) Single quote - the single quote, which stops the shell from interpreting anything within it
2) Double quote - some characters are parsed by the shell, but not all. Variables are interpreted, but filenames, as discussed in the first half of this chapter, are not expanded.
3) Backslash - The third way to mark characters as special is to flag them individually by prefixing them with a backslash (\).
-----------
Other characters you may want to escape with a backslash are
the semicolon (;), which is normally used by the shell to combine multiple commands on one line;
the exclamation mark (!), which is used to call back history;
the ampersand (&), which is used to run a process in the background.
------------
Within double quotes, $, `, \$, \’, \” and \<newline> are treated as normal;
a backslash followed by anything else is not treated as special. So echo
“$HOME\&” displays /home/steve\& and not /home/steve& as it would without
double quotes.
------------
ls file+(1|a)
file1  filea
------------
Regular expressions are different from bash wildcards expansion in that they are far more complete and clearly defined
------------


Comments

Popular posts from this blog

HAproxy logging

tomcat catalina coyote jasper cluster

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all