Oh, please do not treat that as an offensive statement or anything like that! Far from it. What I remember now, maybe this one is enough (I see your point on using wc -l for number of lines etc then checking the number of matched lines, etc, but that is a bit too complex solution for my taste):
if mount | grep -q "^$1" ; then
But of course, the functionality is about the same, so truly, it's not so much an important thing, sorry for even mentioning it.
About the image:
There is something interesting here with the filesystem it seems. Deft sent me an SD card image (thanks!), and that worked (with my emulator I mean, without any problem). Since you told, it's OK for you with your own created one as well, there must be with the copying files process maybe (at my side, I mean, FS creation should be OK, if it worked for you since it should be the very same result). Yes, I am aware of fragmentation, with a new image, I just copy files, and no other modification is done, so hopefully it shouldn't be fragmented at all. How exactly you copied the files? I simply mounted the partition on Linux, and copied the files (maybe I should use some mount options regarding to the FS, or better use mcopy from the mtools package), with the desired name, also caring about the uppercase stuff (though I am not sure if FAT is case sensitive, and I don't mean the OS now, but the disk FS directory entry level, especially with LFNs etc ...). But anyway, even with my image, my emulator booted in the C65 mode, and the C65 ROM itself is loaded by the kickstart, so it can't be totally wrong! The odd thing, that as far as I can tell, it works if a *given* file name is searched for, eg for example C65.ROM. But the disk chooser seems to "scan" the directory and that is the problem that it can't see the end of directory ... Also fragmentation should not apply here anyway, as the files can be loaded by kickstart (ie the C65 ROM) the problem can be seen only at read dir trap issued by the disk chooser utility (SYS49152). I haven't even deleted files, just copied news. With a "brand new" FS created first. I tried several kickup files built myself from all branches of the mega65-core github repository.
Yes, I emulate "hypervisor check points" to be shown, and FPGA-12 switch is emulated to be ON. Btw you can see how it works:
http://c65gs.blogspot.hu/2016/09/mega65-emulator-can-run-kickstart-and.htmlWhat I get (the "Hypervisor serial output:" part is printed by my emulator, the checkpoint itself is generated by the kickstart though):
Hypervisor serial output: "Checkpoint @ $8408 A:$14, X:$14, Y:$0F, Z:$00, P:$35 :trap_dos_readdir ".
Hypervisor serial output: "Checkpoint @ $8983 A:$10, X:$10, Y:$0F, Z:$00, P:$35 :dos_readdir <entry> ".
Hypervisor serial output: "Checkpoint @ $89F7 A:$3F, X:$1B, Y:$0B, Z:$00, P:$35 :next piece (8.3) =??????????? ".
Hypervisor serial output: "Checkpoint @ $8B31 A:$00, X:$1B, Y:$0B, Z:$00, P:$B4 :drce_shortname ".
Hypervisor serial output: "Checkpoint @ $8D00 A:$00, X:$1B, Y:$00, Z:$00, P:$37 :drd_deleted_or_invalid_entry ".
Not counting the first line, the rests repeating. Before this point, I see that valid files are shown, D81's even shown by the chooser. I started to put extra checkpoints in the source, since I can't tell I clearly understand the source at the first glance, maybe it will help me :)
Please note, that I don't think it's the fault of your script, though quite interesting problem for me, at least for some unknown reason to me yet ...