Yes, I googled and looked it up in the manual, and still can't solve this.
Consider this script:
#!/usr/bin/env fish
function xlist
for i in (command ls -1a)
echo $i
end
end
I run it and get 194 items including files and directories. That is wrong. It
should be 192. Ah, sure, it's counting . and .. so it adds two. Let's fix it:
#!/usr/bin/env fish
function xlist
for i in (command ls -1a)
if test $i = "."
continue
end
if test $i = ".."
continue
end
echo $i
end
end
Now I run it and get 192. Good!
But what if I want the two conditions on one line?
#!/usr/bin/env fish
function xlist
for i in (command ls -1a)
if test $i = "."; or test $i = ".."
continue
end
echo $i
end
end
Now I get 193. The ".." entry (or rather the second conditional if I swap . and
.. in the script) is getting through the filter.
What am I doing wrong?
As a side note, simple globbing (for i in *) returns the files only, not any
directories. Is that by design?
--
Luciano ES
>>
------------------------------------------------------------------------------
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users