Jump to content
  • Advertisement
Sign in to follow this  
matrisking

RANDOM shell scripting question

This topic is 4442 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm not sure if this is the appropriate place to ask this question, but here I go... In unix shell scripting, I just noticed that if I enter "ls" in a directory containing 28000+ files it takes a LONG time for the output to appear. However, if I do something like this: > ls | grep "" It happens almost instantly. Same goes for something like this: > echo `ls` (note the grave accents). Can anyone explain why these 2 methods are so much faster that a simple "ls"? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Not knowing what ls implementation and what shell you are using, I'd have to guess that the slow down when you are using ls by itself is that the shell the time to read in the entire directory contents and the formats the output by column. When ls is piped to another application it just writes as fast as it reads the entries.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!