-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.sh
33 lines (29 loc) · 798 Bytes
/
main.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
function tepy () {
template_path="${HOME}/.tepy/template"
template_list=()
if [ ! -d $template_path ]; then
echo "Not found template directory."
mkdir $template_path
return
fi
for template in `find $template_path -maxdepth 1 -mindepth 1 -type d`; do
template_list+=${template##*/}
done
if [ ${#template_list[@]} -gt 0 ]; then
PS3="Please select a number: "
select i in $template_list; do
if [ -n "${i}" ]; then
cp -i -r -v `find "${template_path}/${i}" -maxdepth 1 -mindepth 1` "$pwd"
echo "Copying of ${i} completed."
else
echo "Cannot select ${REPLY}. Please select a number."
fi
break
done
else
echo "Not found template. pls add a directory."
open $template_path
fi
return
}