File: %40cp

package info (click to toggle)
auto-07p 0.9.1%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 16,200 kB
  • sloc: fortran: 22,644; f90: 19,340; python: 19,045; ansic: 11,116; sh: 1,079; makefile: 618; perl: 339
file content (34 lines) | stat: -rwxr-xr-x 642 bytes parent folder | download | duplicates (5)
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
34
#!/bin/sh
error="true"
name1="$1"
name2="$2"
dir1=""
dir2=""
if test -d "$1"; then
    dir1="$1/"
    name1="$2"
    if test $# -eq 4; then
	dir2="$3/"
	name2="$4"
    elif test $# -eq 3; then
	name2="$3"
    fi
elif test -d "$2"; then
    dir2="$2/"
    if test $# -eq 3; then
	file2="$3"
    else
	file2="$1"
    fi
fi
for prefix in b s d c; do
    file1="$dir1$prefix.$name1"
    file2="$dir2$prefix.$name2"
    if cp "$file1" "$file2" 2> /dev/null; then
	echo "Copying $file1 to $file2 ... done"
        unset error
    fi
done
if test -n "$error"; then
    echo "Copying: no files found for $dir1[bsdc].$name1 and $dir2[bsdc].$name2"
fi