1

I'm trying to run the bash script, ~/bin/xlda, ...

#!/bin/sh
# ~/bin/xlda

old_filename="$1"
new_filename=`echo $old_filename | sed 's/\(.*\.\)flac/\1m4a/'`

~/bin/xld -f alac -o "$new_filename" "$old_filename"

new_md5=`~/bin/xld --stdout "$new_filename" | md5`
old_md5=`~/bin/xld --stdout "$old_filename" | md5`

if [ "$new_md5" == "$old_md5" ]
then
    echo "new file md5 $new_md5"
fi

...on files in a find-name-dired buffer using dired-do-async-shell-command in this function

(defun my-dired-files-to-alac ()
  (interactive)
    (dired-do-async-shell-command "~/bin/xlda" current-prefix-arg
     (dired-get-marked-files t current-prefix-arg)))

The xld processes all finish but the md5 is only echo'd for the first shell script to get there. If I run the shell command that emacs runs in a terminal, i.e. ~/bin/xlda folder/file.flac&~/bin/xlda folder/file2.flac then all the md5s are echo'd as expected.

Ultimately, I will rm the old file if the md5s match. Even if the script is simply...

#!/bin/sh
# ~/bin/xlda

old_filename="$1"
new_filename=`echo $old_filename | sed 's/\(.*\.\)flac/\1m4a/'`

~/bin/xld -f alac -o "$new_filename" "$old_filename" && rm "$old_filename"

...it still fails to delete all but one of the *.flac files.

The problem is that emacs seems to exit all shell sub processes when the first shell sub process to finish finishes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.