Add columns and rows parameters

This commit is contained in:
The Magician 2024-03-07 13:35:02 +00:00
parent c5be149197
commit 26d0e38bec
1 changed files with 7 additions and 4 deletions

11
griddle
View File

@ -14,8 +14,8 @@ get_image_dimension() {
}
main() {
if test "$#" -ne 2; then
printf "Usage: griddle <inputfile> <outputfile>\n"
if test "$#" -ne 4; then
printf "Usage: griddle <inputfile> <columns> <rows> <outputfile>\n"
return 1
fi
@ -25,7 +25,10 @@ main() {
return 2
fi
outputfile="$2"
columns="$2"
rows="$3"
outputfile="$4"
if test -e "$outputfile"; then
printf "Output file $outputfile already exists. Overwrite? (y/N) "
read response
@ -40,7 +43,7 @@ main() {
width="$(get_image_dimension $inputfile $WIDTH)"
height="$(get_image_dimension $inputfile $HEIGHT)"
echo "$inputfile" "$outputfile" "Dimensions: $width x $height"
echo "$inputfile" "columns: $columns" "rows: $rows" "$outputfile" "Dimensions: $width x $height"
}
main "$@"