Reading 05: Code
This commit is contained in:
parent
4719d0fa73
commit
241c1e8aec
2 changed files with 26 additions and 0 deletions
11
reading05/Makefile
Normal file
11
reading05/Makefile
Normal 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
15
reading05/exists.py
Executable 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)
|
||||||
Loading…
Reference in a new issue