diff options
Diffstat (limited to 'ffextract-audio')
-rwxr-xr-x | ffextract-audio | 36 |
1 files changed, 13 insertions, 23 deletions
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 () { |