LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-20-2016, 06:28 AM   #1
pioflor
LQ Newbie
 
Registered: Aug 2012
Posts: 2

Rep: Reputation: Disabled
by default command arguments


Is the command cp in bash is by default set on --preserve ?
 
Old 11-20-2016, 06:58 AM   #2
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,452

Rep: Reputation: 1061Reputation: 1061Reputation: 1061Reputation: 1061Reputation: 1061Reputation: 1061Reputation: 1061Reputation: 1061
No.
In bash you can define a function
Code:
cp(){
command cp --preserve "$@"
}
then a simple cp will be like that.
 
Old 11-20-2016, 07:26 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,976

Rep: Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181
Or set up an alilas
 
Old 11-20-2016, 08:21 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 20,237

Rep: Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836
see man cp:
Code:
       --preserve[=ATTR_LIST]
              preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes:  context,
              links, xattr, all
 
Old 11-20-2016, 08:23 AM   #5
pioflor
LQ Newbie
 
Registered: Aug 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
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
 
Old 11-20-2016, 08:31 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 20,237

Rep: Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836
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.
 
Old 11-20-2016, 08:46 AM   #7
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,976

Rep: Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181Reputation: 3181
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
arguments of mknod command rahulbolia Linux - Newbie 4 03-07-2013 08:31 AM
Using Command line arguments Balvinder87 Programming 12 02-21-2013 01:32 AM
a.out command arguments shariefbe Programming 1 11-24-2011 10:30 AM
PHP functions - default arguments jkobrien Programming 2 01-26-2007 04:36 AM
see what arguments are available for a command naijaguy Linux - Newbie 3 08-12-2004 10:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration