LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 07: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, 07:58 AM   #2
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Distribution: Mint/MATE
Posts: 3,020

Rep: Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293
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, 08:26 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Arch
Posts: 10,031

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

Rep: Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814
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, 09: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, 09:31 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,652

Rep: Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814Reputation: 7814
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, 09:46 AM   #7
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Arch
Posts: 10,031

Rep: Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202Reputation: 3202
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 09:31 AM
Using Command line arguments Balvinder87 Programming 12 02-21-2013 02:32 AM
a.out command arguments shariefbe Programming 1 11-24-2011 11:30 AM
PHP functions - default arguments jkobrien Programming 2 01-26-2007 05:36 AM
see what arguments are available for a command naijaguy Linux - Newbie 3 08-12-2004 11:05 PM

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

All times are GMT -5. The time now is 09:14 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