From: Colin Patrick Mccabe Date: Sun, 4 Aug 2013 05:33:09 +0000 (-0700) Subject: mp3chop-fixes X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5d5ffb7bef03013107f73170b2a1b58488c399f;p=cmccabe-bin mp3chop-fixes Signed-off-by: Colin McCabe --- diff --git a/mp3chop.sh b/mp3chop.sh index 6af88f7..2f089f5 100755 --- a/mp3chop.sh +++ b/mp3chop.sh @@ -40,17 +40,18 @@ shift $(( OPTIND-1 )) mkdir -p "$output_dir" || die "failed to create $output_dir" for file in "$@"; do + bfile="$(basename "${file}")" absfile="$(readlink -f "${file}")" - mkdir -p "${output_dir}/${file}.dir" - pushd "${output_dir}/${file}.dir" &>/dev/null \ - || die "failed to pushd to ${output_dir}/file" + mkdir -p "${output_dir}/${bfile}.dir" + pushd "${output_dir}/${bfile}.dir" &>/dev/null \ + || die "failed to pushd to ${output_dir}/bfile" ln "$absfile" || die "failed to hardlink ${absfile}" - mp3splt -t "${segment_size}" "${file}" \ - || die "mp3splt failed on file ${file}" - rm -f "$file" + mp3splt -t "${segment_size}" "${bfile}" \ + || die "mp3splt failed on file ${bfile}" + rm -f "$bfile" mv * .. cd .. - rmdir "${file}.dir" || die "rmdir ${file}.dir failed" + rmdir "${bfile}.dir" || die "rmdir ${bfile}.dir failed" popd &> /dev/null || die "popd failed" done