Monday, October 20, 2008

Interview Question

Nowadays I need to conduct a lot of interviews. When candidate mentions "shell scripting" in their resume, I will normally try to find out how he/she approach a typical scenario like this one:

[Question]: Suppose you are expecting 1000 files in the directory and the filename starts with a prefix followed by a running number say from 1 to 1000 and file extension. Eg, img-1.png, img-2.png, ... etc. However, when you do a ls -l img* | wc -l, you realise that you only have 997 files there. The question will be, how can you tell which 3 files are missing ?

BTW, this is a typical situation I normally encountered during the animation rendering in a grid computing environment. Sometimes the image just cannot be rendered for no obvious reason and I just have to re-submit those missing frames.

I will let my readers to think about this problem before I post the solution. IMO, the ability to simulate such a situation is also considered a skill set, i.e. able to generate 1000 files in a directory. 1.5 years ago I blogged about the limit (32765) of directories in Solaris and I was able to simulate such a situation.

Labels:

0 Comments:

Post a Comment

<< Home