title: How to get bash script to convert mp3 to wav using ffmpeg working?
body: <p>Every time I run this script it doesn't work. I get the output bash: command not found</p>
  
  <p>I ran bash -x to see what was the problem but I don't understand the errors</p>
  
  <pre><code>bash -x mp3towav.sh 
  + for f in '*.mp3'
  + ffmpeg -i '' -acodec pcm_s16le -ac 1 -ar .wav
  ffmpeg version 3.3 Copyright (c) 2000-2017 the FFmpeg developers
    built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
    libavutil      55. 58.100 / 55. 58.100
    libavcodec     57. 89.100 / 57. 89.100
    libavformat    57. 71.100 / 57. 71.100
    libavdevice    57.  6.100 / 57.  6.100
    libavfilter     6. 82.100 /  6. 82.100
    libavresample   3.  5.  0 /  3.  5.  0
    libswscale      4.  6.100 /  4.  6.100
    libswresample   2.  7.100 /  2.  7.100
    libpostproc    54.  5.100 / 54.  5.100
  Trailing options were found on the commandline.
  : No such file or directory
  </code></pre>
  
  <p>script is this </p>
  
  <pre><code>  1 #!/bin/bash
    2 for f in *.mp3; do ffmpeg -i "$file" -acodec pcm_s16le -ac 1 -ar "${file%.mp3}".wav;done
  </code></pre>
  
  <p>when running the corrected code provided I still get an error of:</p>
  
  <pre><code>ffmpeg version 3.3 Copyright (c) 2000-2017 the FFmpeg developers
    built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
    libavutil      55. 58.100 / 55. 58.100
    libavcodec     57. 89.100 / 57. 89.100
    libavformat    57. 71.100 / 57. 71.100
    libavdevice    57.  6.100 / 57.  6.100
    libavfilter     6. 82.100 /  6. 82.100
    libavresample   3.  5.  0 /  3.  5.  0
    libswscale      4.  6.100 /  4.  6.100
    libswresample   2.  7.100 /  2.  7.100
    libpostproc    54.  5.100 / 54.  5.100
  Trailing options were found on the commandline.
  Input #0, mp3, from 'hiraeth [ep].mp3':
    Duration: 00:23:39.36, start: 0.025057, bitrate: 128 kb/s
      Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
      Metadata:
        encoder         : LAME3.99r
      Side data:
        replaygain: track gain - -4.100000, track peak - unknown, album gain - unknown, album peak - unknown, 
  At least one output file must be specified
  </code></pre>