From 37597db597c517498165946a141d6192560acf0e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 2 Dec 2024 20:51:28 +0100 Subject: Second commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- ffextract-audio | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'ffextract-audio') diff --git a/ffextract-audio b/ffextract-audio index b95dd8f..24ca2c1 100755 --- a/ffextract-audio +++ b/ffextract-audio @@ -13,29 +13,19 @@ delete_in_file=no ffmpeg_flag_y= status=0 -while test "${1::1}" = '-'; do - if test "${1}" = '--'; then - shift - break - elif test "${1}" = '-'; then - break - fi - - arg="${1:1}" - while test -n "${arg}"; do - flag="${arg::1}" - arg="${arg:1}" - if test "${flag}" = r; then - recursive=yes - elif test "${flag}" = D; then - delete_in_file=yes - elif test "${flag}" = y; then - ffmpeg_flag_y=-y - else - usage - fi - do +while getopts Dry flag; do + case "$flag" in + D) + delete_in_file=yes;; + r) + recursive=yes;; + y) + ffmpeg_flag_y=-y;; + ?) + usage;; + esac done +shift $(( ${OPTIND} - 1 )) if test ! $# = 1 && test ! $# = 2; then usage @@ -59,7 +49,7 @@ getext () { } removeext () { - printf '%s\n' "$1" | sed 's/\.[^.]*$//' + printf '%s\0' "$1" | tr '\0\n' '\n\0' | sed 's/\.[^.]*$//' | tr '\0' '\n' } extract () { -- cgit v1.2.3-70-g09d2