Web site development - ShellUsing the Bash Shell141Wildcards are handy when you

ShellUsing the Bash Shell141Wildcards are handy when you want to do something to a whole lot of files. For example, to copy all the files from the /mnt/cdromdirectory to the cur- rent directory, type the following: cp /mnt/cdrom/* . Bash replaces the wildcard character *with the names of all the files in the/mnt/cdromdirectory. The period at the end of the command represents thecurrent directory. You can use the asterisk with other parts of a filename to select a more spe- cific group of files. Suppose you want to use the grepcommand to searchfor the text typedef structin all files of the /usr/includedirectory thatmeet the following criteria: .The filename starts with s. .The filename ends with .h. The wildcard specification s*.hdenotes all filenames that meet these crite- ria. Thus you can perform the search with the following command: grep typedef struct /usr/include/s*.hThe string contains a space that you want the grepcommand to find, so youhave to enclose that string in quotation marks. That way, Bash does not tryto interpret each word in that text as a separate command-line argument. The question mark (?) matches a single character. Suppose that you havefour files image1.pcx, image2.pcx, image3.pcx, and image4.pcx in thecurrent directory. To copy these files to the /mnt/floppydirectory, use thefollowing command: cp image?.pcx /mnt/floppyBash replaces the single question mark with any single character, and copiesthe four files to /mnt. The third wildcard format […] matches a single character from aspecific set of characters enclosed in square brackets. You may want to com- bine this format with other wildcards to narrow down the matching file- names to a smaller set. To see a list of all filenames in the /etc/X11/xdmdirectory that start with xor X, type the following command: ls /etc/X11/xdm/[xX]*
Note: If you are looking for cheap webhost to host and run your apache application check Vision apache web hosting services

Leave a Reply