I have a bash script that contains the following commands, including passing a file to eyeD3, which I installed using Homebrew:
#!/usr/bin/env bash
cd /mnt/c/Users/charl/Downloads;
eyeD3 test.mp3;
When I run it in Windows Subsystem for Linux (WSL) from my Ubuntu bash prompt, I get the correct result:
thompcha@WINDOWS-79UTJUF:/mnt/c/Users/charl/Documents/Scripts$ ./eyed3.sh
/mnt/c/Users/charl/Downloads/test.mp3 [ 7.15 MB ]
-----------------------------------------------------------------------------------------------------
Time: 04:26 MPEG1, Layer III [ 224 kb/s @ 44100 Hz - Stereo ]
-----------------------------------------------------------------------------------------------------
ID3 v2.4:
title: Example Song
artist: Example Artist
album: Example Album
track: 1
-----------------------------------------------------------------------------------------------------
However, if I run the bash script from a batch file like this,
@ECHO OFF
bash.exe -c ./eyed3.sh
PAUSE
the eyeD3 command cannot be run:
./eyed3.sh: line 3: eyeD3: command not found
Press any key to continue . . .
Default system commands like ls can be run in this way from a shell script called by a batch file, but eyeD3 cannot. I'm guessing that the script cannot "see" the environment $PATH when it is run this way, but I'm not sure what to do about it.
I have unchecked "Use legacy console" in the cmd.exe properties.
How can I run a homebrew command in a shell script from a batch file?