Re:Show HN: Janetsh – A new system shell
by codetrotter on Monday May 13, 2019 @09:29AM
(#19899017)
Why did they subtract one from (length all-files) in the gif?
[ Parent
| on HN ]
There is a blank line from find captured in the array. I think it is to remove it from the count.
Re:Show HN: Janetsh – A new system shell
by andrewchambers on Monday May 13, 2019 @05:13PM
(#19904018)
That is right, I also just wanted to show you can do some basic calculation easily inline.
Looks like the last item in the all-files array is an empty string - maybe that's why? Either that, or the current directory (".") might be included as the first element.
Re:Show HN: Janetsh – A new system shell
by codetrotter on Monday May 13, 2019 @10:16AM
(#19899428)
If . was included then .. almost certainly would be as well. But an empty string at the end like you say and as explained by the sibling comment makes sense.
Re:Show HN: Janetsh – A new system shell
by andrewchambers on Monday May 13, 2019 @05:12PM
(#19904012)
The empty line after the split was the reason, also to demonstrate how to do arithmetic.