A Peek at Metacharacters


Metacharacters are special characters that have particular meaning to your shellthe dollar sign or hash mark prompt where you do your work. The two metacharacters I want to look at are the asterisk and the question mark. The following is what they mean to the shell:

*

Match any number of characters

?

Match a single character


Extending our talk of listing files, you could list all files containing ackle by using this command:

$ ls *ackle* hackle hackles tackles 


Similarly, you could find all the words that start with an h like this:

$ ls h* hackle hackles 


Now, if you want to see all the seven-letter words in your directory, use this command:

$ ls ??????? hackles tackles 


Each question mark represents a single letter position.




Moving to Ubuntu Linux
Moving to Ubuntu Linux
ISBN: 032142722X
EAN: 2147483647
Year: 2004
Pages: 201

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net