How do I check (with the shell) if a file with the file-extension .ini exists in /dir?
What would be the fastest way? Thanks!
How do I check (with the shell) if a file with the file-extension .ini
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Look ma! No forks! This should beat, by a million of CPU cycles, any solution with forks to
ls,findand friends.Now there’s one little gotcha here. Can you spot it? Okay, what happens if
/dircontains a file named*.iniliterally (star, dot, ini)? The above will give you a false negative: it reports no ini file although there is one. If you want to prepare for this case (and you should, because you are a careful programmer, giving attention to detail, no gotchas in your code, right?), you slightly modify the first case to read