Shell01 - 42

Using ls -R | wc -l (which miscounts hidden files and directory names). Solution: find . -type f -o -type d | wc -l Key lesson: find is your best friend. ls is your enemy for scripting. 3. skip - The Seduction of sed Prompt: Print every other line (starting from the first).

Good luck, cadet. The shell awaits.

Many beginners try basename or complex string manipulation. Solution: Use find , sed , or basename with parameter expansion. shell01 42

find . -type f -name "*.sh" -exec basename {} .sh \; Key lesson: Read the find man page until you understand -exec and {} \; . Prompt: Count all files and directories in the current directory and all subdirectories. Using ls -R | wc -l (which miscounts

Here is what you need to know to survive (and thrive) in Shell01. Unlike traditional scripting exercises, 42’s Shell01 forbids the use of loops ( for , while , etc.) in several key exercises. Why? Because the Unix philosophy states that text manipulation should be done via filters . ls is your enemy for scripting

But once you finish it, you will never look at a terminal the same way again. You will start piping grep into awk into sort in your sleep. And that is exactly the point.