ch27 14


Quoting Special Characters in Filenames (Unix Power Tools, 3rd Edition) 27.14. Quoting Special Characters in Filenames If you want to work with files that have spaces or special characters in the filenames, you may have to use quotes. For instance, if you wanted to create a file that has a space in the name, you could use the following: /dev/null Section 43.12 % cp /dev/null 'a file with spaces in the name' Normally, the shell uses spaces to determine the end of each argument. Quoting (Section 27.12, Section 27.13) changes that -- for example, the cp command above has only two arguments. You can also use a backslash (\) before a special character. The example below will rename a file with a space in the name, changing the space to an underscore ( _ ): % mv a\ file a_file Using the same techniques, you can deal with any character in a filename: % mv '$a' a At worst, a space in a filename makes the filename difficult to use as an argument. Other characters are dangerous to use in a filename. In particular, using ? and * in a filename is playing with fire. If you want to delete the file a?, you may end up deleting more than the single file. -- BB 27.13. Differences Between Bourne and C Shell Quoting27.15. Verbose and Echo Settings Show Quoting Copyright © 2003 O'Reilly & Associates. All rights reserved.

Wyszukiwarka

Podobne podstrony:
ch27
ch27 (13)
CH27 (11)
ch27
ch27 (9)
ch27 (4)
ch27
DK2192 CH27
ch27
ch27 (3)
ch27 (2)
CH27

więcej podobnych podstron