filename=${fileuser:-"filename"} 请问这句话cp是什么意思思?

From Wikipedia, the free encyclopedia
Screenshot of a
command shell showing filenames in a directory
filename list, with long filenames, foreign letters, comma, dot and space characters as they appear in a software displaying filenames
A filename (also written as two words, file name) is a
used to uniquely identify a
stored in a . Different file systems impose different restrictions on filename lengths and the allowed characters within filenames.
A filename may include one or more of these components:
host (or node or server) – network device that contains the file
device (or drive) – hardware device or drive
directory (or path) – directory tree (e.g., , \TEMP, [USR.LIB.SRC], etc.)
file – base name of the file
type (format or ) – indicates the content type of the file (e.g. .txt, .exe, .COM, etc.)
version – revision or generation number of the file
The components required to identify a file varies across operating systems, as does the syntax and format for a valid filename.
Discussions of filenames are complicated by a lack of standardisation of the term. Sometimes "filename" is used to mean the entire name, such as the Windows name c:\directory\myfile.txt. Sometimes, it will be used to refer to the components, so the filename in this case would be myfile.txt. Sometimes, it is a reference that excludes an extension, so the filename would be just myfile. Such ambiguity is widespread and this article does not attempt to define any one meaning, and indeed may be using any of these meanings. Some systems will adopt their own standardised nomenclature like "path name" but these too are not standardised across systems.
This section requires . (July 2012)
Around 1962, the
introduced the concept of a file (i.e. non-paper file).[]
Around this same time appeared the
(period or full-stop) as a filename extension separator, and the limit to three letter extensions might have come from
16-bit limits.
Traditionally, filenames allowed only
characters, but as time progressed, the number of characters allowed increased. This led to compatibility problems when moving files from one file system to another.
Around 1995, , an extension to the FAT filesystem, was introduced in
3.5. It allowed mixed-case
(LFNs), in addition to classic "8.3" names.
959 officially defined a pathname to be the character string which must be entered into a file system by a user in order to identify a file.
This section requires . (July 2012)
One issue was migration to Unicode. For this purpose, several software companies provided software for migrating filenames to the new Unicode encoding.
Microsoft provided migration transparent for the user throughout the vfat technology
Apple provided "File Name Encoding Repair Utility v1.0".
The Linux community provided “convmv”.
10.3 marked Apple's adoption of Unicode 3.2 character decomposition, superseding the Unicode 2.1 decomposition used previously. This change caused problems for developers writing software for OS X.
Main article:
An absolute reference includes all directory levels. In some systems, a filename reference that does not include the complete directory path defaults to the . This is a relative reference. One advantage of using a relative reference in program configuration files or scripts is that different instances of the script or program can use different files.
This makes an absolute or relative path composed of a sequence of filenames.
Unix-like file systems allow a file to hav in traditional Unix-style file systems, the names are
to the file's
or equivalent. Windows supports hard links on
file systems, and provides the command fsutil in Windows XP, and mklink in later versions, for creating them. Hard links are different from Windows ,
, or . The introduction of
allowed filename aliases. For example, longfi~1.??? with a maximum of eight plus three characters was a filename alias of "long file name.???" as a way to conform to 8.3 limitations for older programs.
This property was used by the move command algorithm which first creates a second filename and then only removes the first filename.
Other filesystems, by design, provide only one filename per file, which guarantees that alteration of one filename's file does not alter the other filename's file.
Length restrictions[]
Some filesystems restrict the length of filenames. In some cases, these lengths apply to the entire file name, as in 44 characters on IBM S/370. In other cases, the length limits may apply to particular portions of the filename, such as the name of a file in a directory, or a directory name. For example, 9 (e.g.,
in ), 11 (e.g. , ,
in DOS), 14 (e.g. early Unix), 21 (), 31, 40 (e.g. ), 15 (e.g. ), 44 (e.g. IBM S/370), or 255 (e.g. early Berkeley Unix) characters or bytes. Length limits often result from assigning fixed space in a filesystem to storing components of names, so increasing limits often requires an incompatible change, as well as reserving more space.
A particular issue with filesystems that store information in nested directories is that it may be possible to create a file whose total name exceeds implementation limits, since length checking may apply only to individual parts of the name rather than the entire name. Many Windows applications are limited to a MAX_PATH value of 260, but Windows file names can easily exceed this limit .
Many file systems, including , , and
systems, allow a
that consists of one or more characters following the last period in the filename, dividing the filename into two parts: a base name or stem and an extension or suffix used by some applications to indicate the . Multiple output files created by an application use the same basename and various extensions. For example, a compiler might use the extension FOR for source input file (for Fortran code), OBJ for the object output and LST for the listing. Although there are some common extensions, they are arbitrary and a different application might use REL and RPT. On filesystems that do not segregate the extension, files will often have a longer extension such as html.
There is no general encoding standard for filenames.
Because file names have to be exchanged between software environments (think network file transfer, file system storage, backup and file synchronization software, configuration management, data compression and archiving, etc.), it is very important not to lose file name information between applications. This led to wide adoption of Unicode as a standard for encoding file names, although legacy software might be non-Unicode-aware.
This section may need to be rewritten entirely to comply with Wikipedia's . . The
may contain suggestions. (September 2012)
Traditionally, filenames allowed any character in their filenames as long as they were file system safe. Although this permitted the use of any encoding, and thus allowed the representation of any local text on any local system, it caused many interoperability issues.
A filename could be stored using different byte strings in distinct systems within a single country, such as if one used Japanese Shift JIS encoding and another Japanese EUC encoding. Conversion was not possible as most systems did not expose a description of the encoding used for a filename as part of the extended file information. This forced costly filename encoding guessing with each file access.
A solution was to adopt Unicode as the encoding for filenames.
In the Mac OS however, encoding of the filename was stored with the filename attributes.
The Unicode standard solves the encoding determination issue.
Nonetheless, some limited interoperability issues remain, such as normalization (equivalence), or the Unicode version in use. For instance, UDF is limited to Unicode 2.0; Mac OS applies NFD Unicode normalization and is optionally case-sensitive (case-insensitive by default.) Filename maximum length is not standard and might depend on the code unit size. Although it is a serious issue, in most cases this is a limited one.
On Linux, this means the filename is not enough to open a file: additionally, the exact byte representation of the filename on the storage device is needed. This can be solved at the application level, with some tricky normalization calls.
The issue of Unicode equivalence is known as "normalized-name collision". A solution is the Non-normalizing Unicode Composition Awareness used in the Subversion and Apache technical communities. This solution does not normalize paths in the repository. Paths are only normalized for the purpose of comparisons. Nonetheless, some communities have patented this strategy, forbidding its use by other communities.[]
To limit interoperability issues, some ideas described by Sun are to:
use one Unicode encoding (such as UTF-8)
do transparent code conversions on filenames
store no normalized filenames
check for canonical equivalence among filenames, to avoid two canonically equivalent filenames in the same directory.
Those considerations create a limitation not allowing a switch to a future encoding different from UTF-8.
Within a single directory, filenames must be unique. Since the filename syntax also applies for directories, it is not possible to create a file and directory entries with the same name in a single directory. Multiple files in different directories may have the same name.
Uniqueness approach may differ both on the case sensitivity and on the
such as NFC, NFD. This means two separate files might be created with the same text filename and a different byte implementation of the filename, such as L"\x00C0.txt" (UTF-16, NFC) (Latin capital A with grave) and L"\x.txt" (UTF-16, NFD) (Latin capital A, grave combining).
Some filesystems, such as , store filenames as upper-case regardless of the
used to create them. For example, a file created with the name "MyName.Txt" or "myname.txt" would be stored with the filename "MYNAME.TXT". Any variation of upper and lower case can be used to refer to the same file. These kinds of file systems are called case-insensitive and are not case-preserving. Some filesystems prohibit the use of lower case letters in filenames altogether.
Some file systems store filenames in the form that they wer these are referred to as case-retentive or case-preserving. Such a file system can be case-sensitive or case-insensitive. If case-sensitive, then "MyName.Txt" and "myname.txt" may refer to two different files in the same directory, and each file must be referenced by the exact capitalisation by which it is named. On a case-insensitive, case-preserving file system, on the other hand, only one of "MyName.Txt", "myname.txt" and "Myname.TXT" can be the name of a file in a given directory at a given time, and a file with one of these names can be referenced by any capitalisation of the name.
From its original inception, Unix and its derivative systems were case-preserving. However, not all Unix-like file systems are case- by default,
is case-insensitive, and
servers usually provide case-insensitive behavior (even when the underlying file system is case-sensitive, e.g.
on most Unix-like systems), and SMB client file systems provide case-insensitive behavior. File system
is a considerable challenge for software such as Samba and , which must interoperate efficiently with both systems that treat uppercase and lowercase files as different and with systems that treat them the same.
File systems have not always provided the same character set for composing a filename. Before
became a de facto standard, file systems mostly used a locale-dependent character set. By contrast, some new systems permit a filename to be composed of almost any character of the Unicode repertoire, and even certain non-Unicode byte sequences. Limitations may be imposed by the file system, operating system, application, or requirements for interoperability with other systems.
Many file system utilities prohibit
from appearing in filenames. In Unix-like file systems, the
and the path separator / are prohibited.
Some file system utilities and naming conventions prohibit particular characters from appearing in filenames:
used as a path name component separator in Unix-like, Windows, and Amiga systems. (For as long as the
setting is set to '/', the DOS
shell would consume it as a switch character, but DOS and Windows themselves always accept it as a separator on API level.)
used as the default path name component separator in DOS, OS/2 and Windows (even if the
is set to '-'; allowed in Unix filenames, see Note 1
used as a wildcard in Unix, W marks a single character. Allowed in Unix filenames, see Note 1
us marks a single character. Also used to indicate start of format-specifier in C and C++ format strings (e.g. %010d).
used as a wildcard in Unix, DOS, RT-11, VMS and Windows. Marks any sequence of characters (Unix, Windows, DOS) or any sequence of characters in either the basename or extension (thus "*.*" in DOS means "all files". Allowed in Unix filenames, see note 1
used to determine the mount point / drive on W used to determine the virtual device or physical device such as a drive on AmigaOS,
and VMS; used as a pathname separator in classic . Doubled after a name on VMS, indicates the DECnet nodename (equivalent to a NetBIOS (Windows networking) hostname preceded by "\\".). Colon is also used in Windows to separate an
from the main file.
designates
in Unix, DOS and W allowed in Unix filenames, see Note 1
used to mark beginning and end of filenames containing spaces in Windows, see Note 1
used to , allowed in Unix filenames, see Note 1
used to , allowed in Unix filenames, see Note 1
allowed but the last occurrence will be interpreted to be the extension separator in VMS, DOS and Windows. In other OSes, usually considered as part of the filename, and more than one period (full stop) may be allowed. In Unix, a leading period means the file or folder is normally hidden.
allowed, but the space is also used as a parameter separator in
applications. This can be solved by quoting, but typing quotes around the name every time is inconvenient.
Note 1: While they are allowed in Unix file and folder names, most
require certain characters such as spaces, &, &, |, \, and sometimes :, (, ), &, ;, #, as well as wildcards such as ? and *, to be quoted or :
five\ and\ six\&seven (example of escaping)
'five and six&seven' or "five and six&seven" (examples of quoting)
The character 0xE5 was not allowed as the first letter in a filename under
and MS-DOS/PC DOS 1.x-2.x, but can be used in later versions.
In Windows utilities, the space and the period are not allowed as the final character of a filename. The period is allowed as the first character, but certain Windows applications, such as , forbid creating or renaming such files (despite this convention being used in Unix-like systems to describe
and directories). Workarounds include appending a dot when renaming the file (which is then automatically removed afterwards), using alternative , or saving a file with the desired filename from within an application.
Some file systems on a given operating system (especially file systems originally implemented on other operating systems), and particular applications on that operating system, may apply further restrictions and interpretations. See
for more details on restrictions.
In Unix-like systems, DOS, and Windows, the filenames "." and ".." have special meanings (current and parent directory respectively).
also uses names like "...", "...." and so on to denote grandparent or great-grandparent directories. All Windows versions forbid creation of filenames that consist of only dots, although names consist of three dots ("...") or more are legal in Unix.
In addition, in Windows and DOS utilities, some words are also reserved and cannot be used as filenames. For example,
CON, PRN, AUX, CLOCK$, NUL
COM1, COM2, COM3, COM4
LPT1, LPT2, LPT3, LPT4 (LPT4 only in some versions of DR-DOS)
LST (only in
and DOS 1.xx)
KEYBD$, SCREEN$ (only in multitasking )
$IDLE$ (only in ,
and higher)
CONFIG$ (only in MS-DOS 7.0-8.0)
Systems that have these restrictions cause incompatibilities with some other filesystems. For example, Windows will fail to handle, or raise error reports for, these legal UNIX filenames: aux.c, q"uote"s.txt, or NUL.txt.
NTFS filenames that are used internally include:
$Mft, $MftMirr, $LogFile, $Volume, $AttrDef, $Bitmap, $Boot, $BadClus, $Secure,
$Upcase, $Extend, $Quota, $ObjId and $Reparse
Main article:
preserving
Allowed character set
Reserved characters
Reserved words
Maximum length
(but stored as bytes)
first character not allowed to be 0x00 or 0xFF
Maximum 9 character base name limit for sequential files (without extension), or maximum 6 and 3 character extens see
0x00-0x1F 0x7F " * / : & & ? \ | + , . ; = [ ] (in some environments also: ! @; DOS 1/2 did not allow 0xE5 as first character)
Device names including: $IDLE$ AUX COM1…COM4 CON CONFIG$ CLOCK$ KEYBD$ LPT1…LPT4 LST NUL PRN SCREEN$ (depending on
status everywhere or only in virtual \DEV\ directory)
Maximum 8 character base name limit and 3 see
0x00-0x1F 0x7F " * / : & & ? \ |
0x00-0x1F 0x7F " * / : & & ? \ |
/ null (i.e., 0x00)
Only in root directory: $AttrDef $BadClus $Bitmap $Boot $LogFile $MFT $MFTMirr pagefile.sys $Secure $UpCase $Volume $Extend $Extend\$ObjId $Extend\$Quota $Extend\$Reparse ($Extend is a directory)
forbids the use of characters in range 1-31 (0x01-0x1F) and characters " * : & & ? \ / | unless the name is flagged as being in the Posix namespace. NTFS allows each path component (directory or filename) to be 255 characters long[ – ].
Windows forbids the use of the MS-DOS device names AUX, CLOCK$, COM1, …, COM9, CON, LPT1, …, LPT9, NUL and PRN, as well as these names with any extension (for example, AUX.txt), except when using Long UNC paths (ex. \\.\C:\nul.txt or \\?\D:\aux\con). (CLOCK$ may be used if an extension is provided.) The Win32 API strips trailing space and period (full-stop) characters from filenames, except when UNC paths are used. These restrictions only apply to W in Linux distributions that support NTFS, filenames are written using NTFS's Posix namespace, which allows any Unicode character except / and NUL.
any 8-bit set
any 8-bit set
old versions of Finder are limited to 31 characters
 : on disk, in classic Mac OS, and at the
layer in Mac OS X; / at the Unix layer in Mac OS X
Mac OS 8.1 - Mac OS X
file systems
any 8-bit set
a leading . indicates that
and file managers will not show the file by default
other than $ # @ - x'C0'
first character must be alphabetic or national ($, #, @)
"Qualified" contains . after every 8 characters or fewer.
any 8-bit set
a leading . indicates a "hidden" file
"Fully portable filenames"
A–Z a–z 0–9 . _ -
hyphen must not be first character
A–Z 0–9 _ .
"close to 180"(Level 2) or 200(Level 3)
Used on CDs; 8 directory levels max (for Level 1, not level 2,3)
any 8-bit set
 : / "
dos.library
any 8-bit set
 : / "
Original File System 1985
any 8-bit set
 : / "
Fast File System 1988
any 8-bit set
 : / "
Professional File System 1993
any 8-bit set
 : / "
Smart File System 1998
Amiga FFS2
any 8-bit set
 : / "
Fast File System 2 2002
Flat filesystem with no subdirs. A full "file specification" includes device, filename and extension (file type) in the format: dev:filnam.ext.
A–Z 0–9 $ - _
32 earlier 9 latterly, 255 for a filename and 32 for an extension.
a full "file specification" includes nodename, diskname, directory/ies, filename, extension and version in the format: OURNODE::MYDISK:[THISDIR.THATDIR]FILENAME.EXTENSION;2 Directories can only go 8 levels deep.
any 8-bit set
 :, =
length depends on the drive, usually 16
any 8-bit set
SPACE ", : NULL CHR$(255)
Disks and tape drives are addressed either using a label (up to 8 characters) or a unit specification. The HP 250 file system does not use directories, nor does it use extensions to indicate file type. Instead the type is an attribute (e.g. DATA, PROG, BKUP or SYST for data files, program files, backups and the OS itself).
Howard, Randall (December 31, 2008). .
David Robinso,, Ienup Sung, Nicolas Williams (March 2006).
(PDF). San Francisco: .
, File Transfer Protocol (FTP)
. . June 1, .
. J3e.de 2013.
. KernelTrap. May 7, .
. Flex hex. Inv Softworks 2011.
. Ned Batchelder 2013.
. Wiki.apache.org. January 21, .
. GameDev.net 2013.
. Wiki.winehq.org. November 8, .
. IEEE Std 1. The Open Group. 2001.
. . August 26, .
. , . See last bulleted item.
(MSDN), filename restrictions on Windows
, Microsoft
Lewine, Donald. POSIX Programmer's Guide: Writing Portable UNIX Programs 1991 O'Reilly & Associates, Inc. Sebastopol, CA pp63-64
Hewlett-Packard Company Roseville, CA HP 250 Syntax Reference Rev 1/84 Manual Part no
Look up  or
in Wiktionary, the free dictionary.
, USA: , Data Management Services
: Hidden categories:}

我要回帖

更多关于 cp是什么意思 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信