Sponsored Content
Full Discussion: A Strange Behaviour!!!
Top Forums Shell Programming and Scripting A Strange Behaviour!!! Post 302152610 by Perderabo on Thursday 20th of December 2007 02:14:31 PM
Old 12-20-2007
To copy stuff, you read from the source and write to the destination. Which of these operations do you think should require write permission on the source? I guess you have never copied anything from a CD?
 

9 More Discussions You Might Find Interesting

1. Linux

/etc/passwd strange behaviour!

Hi there, first of all, here is my conf of a uname -a Linux SAMBA 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown on a fedora machine. Here is my problem: every once in a while, the line containing root disappears in the /etc/passwd, disabling all logging on my server. Any one have... (0 Replies)
Discussion started by: penguin-friend
0 Replies

2. UNIX for Advanced & Expert Users

Strange sed behaviour

$ echo a.bc | sed -e "s/\|/\\|/g" |a|.|b|c| $ Is the behavior of the sed statement expected ? Or is this a bug in sed ? OS details Linux 2.6.9-55.0.0.0.2.ELsmp #1 SMP Wed May 2 14:59:56 PDT 2007 i686 i686 i386 GNU/Linux (8 Replies)
Discussion started by: vino
8 Replies

3. UNIX for Dummies Questions & Answers

Strange Program behaviour

Had a strange thing going on with my code. It's ok I figured it out for myself.... (2 Replies)
Discussion started by: mrpugster
2 Replies

4. Shell Programming and Scripting

strange behaviour from sed???

Hi all, I want to do a very simple thing with sed. I want to print out the line number of a disk I have defined in /etc/exports, so I do: It's all good, but here's the problem. When I define md0 in a variable, I get nothing from sed: Why is that? can anybody please help? Thanks (2 Replies)
Discussion started by: alirezan
2 Replies

5. Shell Programming and Scripting

Strange behaviour with perl i/o?

Hi All, I got a strange problem here. I have a perl script which is fetching data from a database table and writing a file with that data. If i run that script from linux command line, the file it creates is a normal ascii text file without any binary character in it.But... (9 Replies)
Discussion started by: DILEEP410
9 Replies

6. HP-UX

Strange login behaviour

Hi all, I am using HP-UX and I have just noticed that when I log into the network it seems to save the previous windows that were subsequently closed on previous occasions. Does anyone know when I log in, it seems to display these previous windows, e.g. nedit windows open again? Does... (1 Reply)
Discussion started by: cyberfrog
1 Replies

7. Shell Programming and Scripting

Strange RegExp Behaviour

Hello, I was trying to identify lines who has a word of the following pattern "xyyx" (where x, and ys are different characters). I was trying the following grep - egrep '(\S)()\2\1' This pattern do catches the wanted pattern, but it also catches "GGGG" or "CCCC" patterns. I was trying to... (5 Replies)
Discussion started by: itskov
5 Replies

8. Red Hat

Crontab strange behaviour

Hi all, I'm having this scenario which for the moment I cannot resolve. :( I wrote a script to make a dump/export of the oracle database. and then put this entry on crontab to be executed daily for example. The script is like below: cat /home/oracle/scripts/db_backup.sh #!/bin/ksh ... (3 Replies)
Discussion started by: enux
3 Replies

9. Shell Programming and Scripting

Strange behaviour of arrays in awk

Imagine 2 files f1 f2: file1_l1_c1 code_to_find file1_l1_c3 file1_l2_c1 file1_code2 file1_l2_c3 file1_l3_c1 file1_code3 file1_l3_c3 file2_l1_c1 file2_l1_c2 code_to_find file2_l2_c1 file2_l2_c2 file2_code5 file2_l3_c1 file2_l3_c2 file2_code3 Say we want to print lines from f2 having... (5 Replies)
Discussion started by: ripat
5 Replies
cp(1)							      General Commands Manual							     cp(1)

NAME
cp - Copies files SYNOPSIS
cp [-fhip] [--] source_file destination_file cp [-fhip] [--] source_file... destination_directory cp [-fhip] [-r | -R] [--] [source_file | source_directory]... destination_directory The cp command copies a source file or the files in a source directory to a destination file or directory. If your source and destination are directories, the source is copied to the destination and created with the same name. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: cp: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
[Tru64 UNIX] The cp command does not prompt you when an existing file is to be overwritten. (If both -f and -i are specified on the com- mand line--for example, because an alias includes one of them--whichever appears last overrides the other.) [Tru64 UNIX] Together with the -R option, the same as the -r option. Prompts you with the name of the file whenever the copy would cause an existing file to be over- written. An answer beginning with y, or the locale's equivalent of y, causes cp to continue. Any other answer prevents it from overwriting the file. Preserves for the copy the modification time, access time, file mode, user ID, and group ID of the original, as allowed by per- missions. If the user ID and group ID cannot be preserved, no error message is displayed and the exit value is not altered. If the origi- nal is set-user-ID or set-group-ID, and either the user ID or the group ID cannot be preserved, the set-user-ID and set-group-ID bits are not preserved in the copy's permissions. [Tru64 UNIX] Preserves the extended file attributes (property list), including the access control list (ACL) if any. When the source is a directory, copies the directory and the entire subtree connected at that point. Special file types, such as symbolic links, named pipes (FIFOs), and block and character devices, are opened and their contents are copied to regular files having the same name. (This may be desired for links but is probably not desired for disk, tape, or network devices.) For example, if a is a symbolic link to file z and a is copied to b with the -r option, b is not a symbolic link to file z but is a copy of it. As with -r, when the source is a directory, copies the directory and the entire subtree connected at that point. However, destination_files are created with the same file types as source_files, for instance symbolic links, named pipes (FIFOs), or block or character devices. As an example, if a is a symbolic link to file z and a is copied to b with the -R option, b will also be a symbolic link to file z. If source_file is a FIFO, the file permission bits of destination_file are set to those of source_file modified by the file creation mask of the user if the -p option is not used. Indicates that the arguments following this option are to be interpreted as file names. This null option allows the specification of file names that start with a minus. DESCRIPTION
If a destination file already exists, its contents are overwritten if permissions allow, but cp does not change its mode, user ID, or group ID. However, if the file is not being copied by the root user, writing the file may clear the set-user-ID or set-group-ID permission bits. If the destination file does not exist, the mode of the source file is used, as modified by the file mode creation mask (umask). If the source file is either set-user-ID or set-group-ID, those bits are removed unless the -p option is used. Appropriate permissions are always required for file creation or overwriting. [Tru64 UNIX] You can also copy special device files. If the file is a named pipe, the data in the pipe is copied into a regular file. If the file is a device, the file is read until the end of file, and that data is copied into a regular file. The LC_MESSAGES variable determines the locale's equivalent of y or n (for yes/no queries). If the source_file is a directory, the following is true: If neither the -R or -r option was specified, an error message is displayed and source_file is not copied. If the target specified exists and is a file, not a directory, an error message is displayed and source_file is not copied. If the target does not exist and the -p option is specified, the permission bits of the target directory are set equal to the source directory bitwise inclusively ORed with S_IRWXU (0700 octal). This means the newly created directory will always allow the owner read, write and execute permission. If the target does not exist and the -p option is not specified, the permission bits of the target directory are set equal to the source directory bits, modified by the file creation mask of the user (shuts off the corresponding permis- sion bits specified in the umask). The resulting permission bits are then ORed with S_IRWXU (0700 octal) which gives the owner read, write and execute permission. If the target does not exist and cannot be created, an error message is displayed and source_file is not copied. NOTES
Do not give the destination the same name as one of the source files. If you specify a directory as the destination, the directory must already exist. If you are using the -r option to copy the contents of one directory to another, and source_directory contains subdirecto- ries that do not exist in destination_directory, the subdirectories are created. EXIT STATUS
The following exit values are returned: Successful completion. An error occurred. EXAMPLES
To copy one file to another, enter: cp file1 file2 If file2 exists (and is writable), it is replaced by file1. To copy files to a directory, enter: cp file1 file2 dir1 The dir1 directory must exist. To copy all files in a directory and preserve their modification times, enter: cp -p dir1/* dir2 To copy a directory tree to another directory, enter: cp -r dir1 dir2 The dir1 tree is created in dir2. ENVIRONMENT VARIABLES
The following environment variables affect the execution of cp: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: cpio(1), find(1), link(1), ln(1), mv(1), pax(1), tar(1), umask(1) Functions: umask(2) Files: proplist(4), acl(4) Standards: standards(5) cp(1)
All times are GMT -4. The time now is 04:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy