logoalt Hacker News

collinfunktoday at 5:16 AM1 replyview on HN

No need to apologize at all. Doing it in one cd invocation would fail since the file name is longer than PATH_MAX. In that case passing it to a system call would fail with errno set to ENAMETOOLONG.

You could probably make the loop more efficient, but it works good enough. Also, some shells don't allow you to enter directories that deep entirely. It doesn't work on mksh, for example.


Replies

dapperdraketoday at 5:41 AM

Facetious reply:

> However, GNU software tends to work very hard to avoid arbitrary limits [1].

show 2 replies