Last active
December 26, 2015 12:29
-
-
Save nobucshirai/7151864 to your computer and use it in GitHub Desktop.
A wapper script of cp. Copy files to temporary directory of current directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # $Id: box_cp.sh,v 1.2 2013-10-25 21:30:26+09 shirai Exp shirai $ | |
| main(){ | |
| ArgCheck $@ | |
| BoxMaker | |
| diae cp -av ${file_list[@]} ${box_dir} | |
| } | |
| ArgCheck(){ | |
| Ind=0 | |
| file_list=() | |
| for file in $@; do | |
| ((Ind++)) | |
| if [[ $Ind != $# ]] ;then | |
| file_list=(${file_list[@]} $file) | |
| else | |
| dir_path=$file | |
| fi | |
| done | |
| } | |
| BoxMaker(){ | |
| box_dir="${dir_path}/_box" | |
| if [ ! -e $box_dir ];then | |
| mkdir $box_dir | |
| else | |
| box_dir="${dir_path}_box_${RANDOM}" | |
| if [ ! -e $box_dir ];then | |
| mkdir $box_dir | |
| else | |
| echo " mkdir $box_dir was failed." | |
| exit | |
| fi | |
| fi | |
| } | |
| diae(){ | |
| echo $@ | |
| $@ | |
| } | |
| main $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment