我需要计算文件中的行数,然后根据行数是否小于或等于 20 发送一条消息。我尝试这样做:
touch file.txt echo "hello" > file.txt nr_lines = $(wc -l < file.txt) if[$nr_lines -le 20]; then echo "number of lines is less than 20." fi
但这不起作用。我究竟做错了什么?
bash shell
bash ×1
shell ×1