题解 | #打印文件的最后5行#
打印文件的最后5行
https://www.nowcoder.com/practice/ff6f36d357d24ce5a0eb817a0ef85ee2
#!/bin/bash # 确保文件存在 if [ -f "nowcoder.txt" ] then # 输出文件最后5行 tail -n 5 nowcoder.txt else echo "文件 nowcoder.txt 不存在。" fi
打印文件的最后5行
https://www.nowcoder.com/practice/ff6f36d357d24ce5a0eb817a0ef85ee2
#!/bin/bash # 确保文件存在 if [ -f "nowcoder.txt" ] then # 输出文件最后5行 tail -n 5 nowcoder.txt else echo "文件 nowcoder.txt 不存在。" fi
相关推荐