Sample Header Ad - 728x90

xxx.sh: : not found

-1 votes
1 answer
1552 views
I'm debugging a shell script and coming across this error. I have no idea what's going on with my script. #!/system/bin/sh function SetEQ(){ prefFile='/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' # a comment line that was deleted by me, sorry for that. case $1 in speaker) array=(0.0 0.0 0.0 -3.64 -10.66 -15.0 -6.49 0.0) ;; samsung) array=(0.0 2.9 0.0 -1.5 -6.4 2.7 0.0 0.0) ;; *) exit ;; esac for i in ${!array[@]}; do sed -ir "s/(\"com.smp.equalizer.$i\" value=\")[^\"]*(\")/\1${array[$i]}\2/" "$prefFile" done } SetEQ samsung When I run the script by: # sh -vx ./test2.sh The debug information is as follows: + SetEQ samsung + prefFile='/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' + set -A array -- 0.0 2.9 0.0 -1.5 -6.4 2.7 0.0 0.0 + sed -ir 's/("com.smp.equalizer.0" value=")[^"]*(")/\10.0\2/' '/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.1" value=")[^"]*(")/\12.9\2/' '/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.2" value=")[^"]*(")/\10.0\2/' '/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.3" value=")[^"]*(")/\1-1.5\2/' '/mnt/media_rw/6633-353/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.4" value=")[^"]*(")/\1-6.4\2/' '/mnt/media_rw/6633-353/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.5" value=")[^"]*(")/\12.7\2/' '/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.6" value=")[^"]*(")/\10.0\2/' '/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found + sed -ir 's/("com.smp.equalizer.7" value=")[^"]*(")/\10.0\2/' '/mnt/media_rw/6633-3539/tmpFiles/com.smp.musicspeed_preferences.xml' ./test2.sh: : not found I have to say that the sed lines have no issue when I run them directly in the terminal. The debug information is very vague, what is not found? The command? The script file? The paths given to sed? **EDIT: @Paul_Pedant was right, I forgot to have copyed the sed line to Windows system than paste them back to VI. After re-enter the line by hand, the problem solved!**
Asked by preachers (151 rep)
Feb 20, 2023, 02:16 PM
Last activity: Feb 20, 2023, 02:53 PM