-
Notifications
You must be signed in to change notification settings - Fork 4
/
collate.scans.sh
executable file
·60 lines (51 loc) · 1.58 KB
/
collate.scans.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
. include arrays array classes upvars exceptions
srcdir="/Users/cyrus/Documents/ANDERSON_IMAGES_RAID_SORTED"
srcdir="/Users/cyrus/Documents/MISC_R2" # S_OF_INTEREST/misc" # { declare -F sc ||
array=($(ls "$srcdir"))
echo "${array[@]}"
# array_shift pigname array
# array_push array "sausage"
# echo the pigs name was $pigname
# echo and he "${array[@]}"
# the pigs name was pinky
# and he went to porky town and bought a pig blanket
newcount=1
newfn="ANDERSON_IMAGES_RAID_SORTED_"
ext=".tif"
array_count array
count=$?
echo $count elements in array
(( half = count / 2 ))
while (( half -- ))
do
array_shift fn array &&
{
printf -v nfn "%s/%s%03d%s" "$srcdir" "$newfn" $(( newcount ++ )) "$ext"
mv "$srcdir/$fn" "$nfn"
}
array_pop fn array &&
{
printf -v nfn "%s/%s%03d%s" "$srcdir" "$newfn" $(( newcount ++ )) "$ext"
mv "$srcdir/$fn" "$nfn"
}
done
exit
declare -p array
array_push newarray "start"
array_push newarray "one"
array_push newarray '"two"'
array_push newarray 'three "4" five' 6 seven
array_push newarray "three" 4 "five"
declare -p newarray
array_shift word newarray && declare -p word
array_shift word newarray && declare -p word
array_shift word newarray && declare -p word
array_shift word newarray && declare -p word
array_shift word newarray && declare -p word
array_shift word newarray && declare -p word
array_shift word newarray && declare -p word
array_shift word newarray && declare -p word
array_shift word newarray && declare -p word
array_shift word newarray && declare -p word
}