utility

cp

Copy source to destination. May overwrite existing files; use a new destination in the fixture.

Formal Syntax & Structure

bash syntaxbash
cp [OPTION] SOURCE DEST

Parameters & Attributes

NameTypeDescription
SOURCEpathSource file.
DESTpathNew destination.

Return Value

exit status

Exit status 0 on success; nonzero indicates failure or a command-specific condition. See description and example.

Working Example

Example Snippetbash
printf 'notes\n' > './-draft notes.txt'cp -- '-draft notes.txt' 'copy notes.txt'cat -- 'copy notes.txt'
Bash Reference