File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,18 @@ filenameB=$(basename $5)
36
36
extB=${filenameB##* .}
37
37
38
38
# Header row
39
- sizeA=$( expr $( ls -l $fileA | awk ' {print $5}' ) / 1024)
40
- sizeB=$( expr $( ls -l $fileB | awk ' {print $5}' ) / 1024)
39
+ if [ -f $fileA ] ; then
40
+ sizeA=$( expr $( ls -l $fileA | awk ' {print $5}' ) / 1024)
41
+ else
42
+ sizeA=0
43
+ fi
44
+
45
+ if [ -f $fileB ] ; then
46
+ sizeB=$( expr $( ls -l $fileB | awk ' {print $5}' ) / 1024)
47
+ else
48
+ sizeB=0
49
+ fi
50
+
41
51
headerA=" OLD: $( basename $1 ) ($sizeA KB)"
42
52
headerB=" NEW: $( basename $5 ) ($sizeB KB)"
43
53
@@ -55,8 +65,13 @@ printf "$(yes " " | head -n$sideBySideBuffer | tr -d '\n')"
55
65
printf " $( yes " —" | head -n$perDiffWidth | tr -d ' \n' ) "
56
66
echo
57
67
58
- outputA=$( convert $fileA jpg:- | jp2a --color --width=$perDiffWidth -)
59
- outputB=$( convert $fileB jpg:- | jp2a --color --width=$perDiffWidth -)
68
+ if [ -f $fileA ] ; then
69
+ outputA=$( convert $fileA jpg:- | jp2a --color --width=$perDiffWidth -)
70
+ fi
71
+
72
+ if [ -f $fileB ] ; then
73
+ outputB=$( convert $fileB jpg:- | jp2a --color --width=$perDiffWidth -)
74
+ fi
60
75
61
76
heightA=$( echo " $outputA " | wc -l | xargs)
62
77
heightB=$( echo " $outputB " | wc -l | xargs)
You can’t perform that action at this time.
0 commit comments