cp ã³ãã³ãã«ã¯ãgnu æ¨æºã®ããã¯ã¢ããã»ãªãã·ã§ã³ãè¨å®ããã¦ããã¨ããã£ãã
-b ãã¤ããã¨ããã¯ã¢ããã¢ã¼ã
ããã¯ã¢ããã¢ã¼ããã¤ããã¨ãæ¡å¼µåã®å¾ãã«ã ~ (tilde)ã ãã¤ããããã¯ã¢ãããåãããã
takuya@rena:~/Desktop$ cp -rT -b test test2 takuya@rena:~/Desktop$ tree test2 test test2 âââ a.txt âââ a.txt~ test âââ a.txt
ããã¯ã¢ããã®~ ãã«ãã¯ç°å¢å¤æ° SIMPLE_BACKUP_SUFFIX ã§æå®å¯è½ã§ãã
.back ã®æ¡å¼µåã§ããã¯ã¢ããã¨ãã¤ã¤cp
ãã«ãã ã¨Emacs ã£ã½ãããåºå¥ãã¤ããªããããªã®ã§ãæ¡å¼µåãããã¦ã¿ãã
takuya@rena:~/Desktop$ export SIMPLE_BACKUP_SUFFIX=".back" takuya@rena:~/Desktop$ cp -rT -b test test2 takuya@rena:~/Desktop$ tree test2 test test2 âââ a.txt âââ a.txt.back test âââ a.txt 0 directories, 3 files
ãªãã»ã©ãããã¯ããã§ä¾¿å©ããã
ããã¯ã¢ãããæ°åã§Nä¸ä»£åã¾ã§ã
ï¼åã³ãã¼ããã£ãã
takuya@rena:~/Desktop$ cp -rT test test2 # ãã¹ããã£ã¬ã¯ããªä½æ takuya@rena:~/Desktop$ cp -rT --backup=numbered test test2 takuya@rena:~/Desktop$ cp -rT --backup=numbered test test2 takuya@rena:~/Desktop$ cp -rT --backup=numbered test test2 takuya@rena:~/Desktop$ cp -rT --backup=numbered test test2
ï¼åå®è¡ãã¦ã¿ãã
ã³ãã¼å
takuya@rena:~/Desktop$ tree test test âââ a.txt 0 directories, 1 file
ã³ãã¼å
takuya@rena:~/Desktop$ tree test2 test2 âââ a.txt # ææ°ã®ã³ãã¼ï¼ï¼ååï¼ âââ a.txt.~1~ # ï¼åå âââ a.txt.~2~ # ï¼åå âââ a.txt.~3~ # ï¼åå (ååã³ãã¼æï¼ 0 directories, 4 files
å人çã«ã¯
a.`date -I`.back.txt #=> a.2014-09-25.back.txt a.n.txt #=> a.1.txt a.2.txt
ã®ãããªãæ¡å¼µåãå¤ããªãããã¡ã¤ã«åã好ããªã®ã ããã©ããã
ã¡ãªã¿ã« cp -rT ã使ãã¨ãã£ã¬ã¯ããªããã«ã£ã¨ã³ãã¼
takuya@rena:~/Desktop$ cp -rT test test2
ããã¯ãã£ã¬ã¯ããªããã£ã¬ã¯ããªä½æãã¦ã³ãã¼ãã¦ããè¦ãã¦ããã¨ä¾¿å©ã