james147 was helping me with a bash script the other day. Today I was trying to modify this to search for archives with out launching a konsole(I ma using konsole with this script but only for the sake of debugging.) So the service menu is simply
Exec=konsole --hold --workdir %f -e /home/xplorer4x4/.kde/share/kde4/services/ServiceMenus/searchforarchives.sh %U
I will dump konsole --hold --workdir %f -e once the script is done. I need to run if find *.part01.rar else find *.rar and else fail. Here is what I came up with, but getting errors. Maybe I tried to jump in over my head here. Maybe I am just to tired. I was hopping you guys could point me in the right direction:
Exec=konsole --hold --workdir %f -e /home/xplorer4x4/.kde/share/kde4/services/ServiceMenus/searchforarchives.sh %U
I will dump konsole --hold --workdir %f -e once the script is done. I need to run if find *.part01.rar else find *.rar and else fail. Here is what I came up with, but getting errors. Maybe I tried to jump in over my head here. Maybe I am just to tired. I was hopping you guys could point me in the right direction:
Code:
#!/bin/bash
searchextractrar() {
input="${1}"
if [ find "${input}" -type f -name *.part01.rar ]; then
kdialog --passivepopup "Extracting $FILE complete." 60
elif [ find "${input}" -type f -name *.rar ]; then
kdialog --passivepopup "Extracting $FILE complete." 60
else
kdialog --passivepopup "Failed to extract $FILE." 60
return 1 Change to exit 1 to stop the script on first failure
fi
}
for file in ${@} ; do
searchextractrar && unrar e $FILE
done



Comment