Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
目的:我想尾随 file.txt 的最后一行并输入一个变量以用于通过 sed 进行替换。
代码:
ALARM_POPUP_CONTENT=(tail -1 /logs/file.txt) ALARM_POPUP_CONTENT=tail -1 /logs/file.txt
结果:
这仅输出工作“尾”或第二个选项未找到的错误命令。有什么建议么?
尝试:
ALARM_POPUP_CONTENT=$(tail -1 /logs/file.txt)
或带反引号:
ALARM_POPUP_CONTENT=`tail -1 /logs/file.txt`