ok so it still doesnt work. heres the problem. this is the current script:
Code:
#!/bin/bash
echo "ED2K GUI Preview"
echo "----------------"
echo
echo "Got the following parameter: $1"
echo "File extension : $ED2K_PREVIEW_EXTENSION"
echo
echo "Enter command to run on the file, typing [] in place"
echo "of the file path:"
read PREVIEW_BIN
echo $PREVIEW_BIN > pretemp
sed -i "s|[]|"$1"|g" pretemp
TO_RUN=`cat pretemp`
rm pretemp
echo "Running: $TO_RUN"
$TO_RUN
echo "Finished. Hit <enter> to close this window"
read
basically, this should get a file as a parameter, print some stuff about it, then recieve a command to run. it will find a [] in this and then replace it with the file. it will then run the command. supposedly. here is the current output:
Code:
ED2K GUI Preview
----------------
Got the following parameter: /home/drigz/music/Goldfrapp Black - Cherry/03-goldfrapp-black_cherry-esc.mp3
File extension :
Enter command to run on the file, typing [] in place
of the file path:
hello [] bye
sed: -e expression #1, char 32: Unterminated `s' command
Running: hello [] bye
ed2k_gui_preview: line 19: hello: command not found
Finished. Hit <enter> to close this window
i was using hello [] bye as an example, i know it wont work as a command. the problem is the replacing doesnt work.
can anyone suggest either a way to make it work, or a better script (ie one which doesnt need to create files and stuff (im not great at bash scripting))
thanks.
btw, i know that generally just running:
command file
would work - this is what it used to be. the change is so that i can mount isos when they are incomplete, to check if they are real or fake (mount -t iso9660 -o loop [] /mnt/cdrom0)