Course of Raku / Objects, I/O, and exceptions / Input and output / Running external programs 🆕 / Exercises
Pass a variable to a child
Problem
Create a file notes.txt and write a few lines into it.
Put its name into an environment variable NOTES. Then use
shell to run wc -l, reading the file name from
$NOTES, so the child counts the lines and prints the
number. Finally, delete the file from Raku — with unlink,
not through the shell.
Example
The program prints:
3(and leaves no notes.txt behind.)
Solution
Course navigation
← Solution: Check the exit code | Solution: Pass a variable to a child →