Reading 05: Code

This commit is contained in:
Owen Dorweiler 2025-02-17 13:35:11 -05:00 committed by Mayleen Liu
commit 241c1e8aec
2 changed files with 26 additions and 0 deletions

11
reading05/Makefile Normal file
View file

@ -0,0 +1,11 @@
test:
@$(MAKE) -sk test-all
test-all: test-scripts test-exists
test-scripts:
curl -sLO https://www3.nd.edu/~pbui/teaching/cse.20289.sp25/static/txt/reading05/test_exists.sh
chmod +x test_*.sh
test-exists:
./test_exists.sh

15
reading05/exists.py Executable file
View file

@ -0,0 +1,15 @@
#!/bin/env python3
import os
import sys
exit_code = 0
for filename in sys.argv[1:]:
if os.path.exists(filename):
print(f"{filename} exists!")
else:
print(f"{filename} does not exist!")
exit_code = 1
sys.exit(exit_code)