Here is some background info:
I have many .txt files on an ntfs partition, and frequently need to Pfind some of them to edit. When the relevent files are found in Pfind, they cannot be double clicked to edit, because puppy (or rox-filer or pfind) sees any plain text file on a non-linux partition as executable. Double-clicking simply runs them. Have to use right-click and choose "open as text". I find this very annoying and decided to modify the Pfind program. And that's the scenario where weird things happend.
System: fossapup64_9.5
First attempted solution (with weird behavior):
I modified the following part of /usr/local/pfind/func:
Code: Select all
-execute) #open with MIME-type settings
$FILEMANAGER "$2"
;;
to:
Code: Select all
-execute) #open with MIME-type settings
if echo "$2" | grep -i "\.txt$"
then
leafpad "$2"
else
$FILEMANAGER "$2"
fi
;;
Then I tested it like this:
Code: Select all
echo "galculator" > /mnt/sdb2/zzz.txt
Then search out this file with Pfind. Double click it. It is opened by leafpad. Seems OK, Huh? Here is the weird thing. When I close the leafpad window and the Pfind window, Galculator pops up!
Second solution which worked without any problem:
The above code in /usr/local/pfind/func was modifed to:
Code: Select all
-execute) #open with MIME-type settings
if [[ "$2" == *.txt ]]
then
leafpad "$2"
else
$FILEMANAGER "$2"
fi
;;
I don't see any substantial difference between solution 1 and 2, but why did solution 1 turn wacky? What am I missing?