From f94b0ab07e9aa67c5969a055d766cac1636228f6 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Wed, 2 Sep 2020 13:05:41 +0200 Subject: [PATCH] cbz2ebook: Remove dependency on my zshrc This script could now easily be ported to bash (or even sh), but we are using nix-shell anyway, so why not use zsh. --- cbz2ebook.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cbz2ebook.sh b/cbz2ebook.sh index 52fb7ab..7f70a42 100755 --- a/cbz2ebook.sh +++ b/cbz2ebook.sh @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#!nix-shell -i "zsh -i" -p imagemagick unzip zip zsh +#!nix-shell -i zsh -p imagemagick unzip zip zsh set -e size="1440x1920" # Kobo Forma @@ -19,7 +19,14 @@ trap cleanup EXIT INT SIGTERM cd "$tmpdir" unzip "$infile" -renumber 4 **/*.??? + +# rename files to have a plain 4 digit filename +i=1 +for file in **/*.???; do + mv -n "$file" "$(dirname $file)/$(printf %04d $i).${file##*.}" + i=$((i+1)) +done + length=$(ls -1 **/*.??? | wc -l) position=0 for image in **/*.???; do