qfedu-linux-advanced-level/day1/d17.sh

4 lines
162 B
Bash
Raw Permalink Normal View History

2023-08-14 15:53:04 +08:00
#!/bin/bash
# 当 a.txt 存在时,执行 echo "good" >> a.txt否则执行 echo "bad" >> a.txt
test -e a.txt && echo "good" >> a.txt || echo "bad" >> a.txt