${file%/*} replaces spaces with underscores

281 views Asked by At

converting mp3 to ogg-files is dine by a simple script.

But: When i construct the new pathname and filename with

    # set the 'file' variable first
    file="$1"
    # get extension; everything after last '.'
    ext=${file##*.} 
    mp32ogg --verbose --delete --quality=0 --rename="${file%/*}/`basename "$file" .${file##*.}`"  "$1"|| exit 1

the file-/pathnames that have spaces will be created with underscores.

And i see no reason... all help is welcome!

Appelgebak

1

There are 1 answers

2
Adam Rosenfield On

By default, mp32ogg automatically replaces spaces (and lots of other non-alphabetic characters) with underscores in the output filename. To suppress this behavior, pass in the (undocumented) --no-replace flag.