I want to batch processing a bunch of wav files with SoX (to Adjust their volume). I face a problem with assign the Volume Adjustment output from sox file.wav -n stat -v. I tried with this:
I found there are many examples on web about this operation, but these examples are not so complex like data=$(data). I tried VOLUME_ADJUST="$(sox  $1 -n stat -v)" but the result output to my terminal not assign to the variable. When I echo it nothing shows up.
Thanks for your suggestion. My code is as follows:
#!/bin/sh
RED='\033[0;31m'
NC='\033[0m'
BLUE='\033[0;34m'
GREEN='\033[0;32m'
Process () {
    printf "Process with ${RED}$1${NC}\n";
    printf "Volume up as high as possible?[y/n]";
    read PASS;
    if test "$PASS" = "y"; then
        a="$(date)"
        VOLUME="$(sox "$1" -n stat -v)"
        #echo $VOLUME
        # eval "sox -v $VOLUME_ADJUST $1 $1"
        #printf $?
    elif test "$PASS" = "n"; then
        printf "${GREEN}Volume up skipped.${NC}"
    fi
}
Process "test.wav"
 
    