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

4 lines
162 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 当 a.txt 存在时,执行 echo "good" >> a.txt否则执行 echo "bad" >> a.txt
test -e a.txt && echo "good" >> a.txt || echo "bad" >> a.txt