LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   by default command arguments (https://www.linuxquestions.org/questions/linux-newbie-8/by-default-command-arguments-4175593897/)

pioflor 11-20-2016 06:28 AM

by default command arguments
 
Is the command cp in bash is by default set on --preserve ?

MadeInGermany 11-20-2016 06:58 AM

No.
In bash you can define a function
Code:

cp(){
command cp --preserve "$@"
}

then a simple cp will be like that.

grail 11-20-2016 07:26 AM

Or set up an alilas

pan64 11-20-2016 08:21 AM

see man cp:
Code:

      --preserve[=ATTR_LIST]
              preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes:  context,
              links, xattr, all


pioflor 11-20-2016 08:23 AM

I do not really understand.
The manual system [1]there are two mutually exclusive options: --preserve and --no-preserve. Logic suggests that one of option must be the default.

[1] http://man7.org/linux/man-pages/man1/cp.1.html

pan64 11-20-2016 08:31 AM

the default what is written as default and is highlighted in my previous post:
(default: mode,ownership,timestamps)
so by default these attributes are preserved, others are not.

grail 11-20-2016 08:46 AM

As pointed out by pan64, your assumption is wrong as there are some default options preserved but not all, so --preserve allows you to preserve more than the default and --no-preserve allows you to remove all that may have been preserved, either by default or a previous setting.


All times are GMT -5. The time now is 08:54 PM.