-1
我有一个shell脚本,它通过将变量的内容写入内存位置中的文件以编程方式创建文件。编程创建的文件在Linux中变为NULL
file=/downloads/fileName.crt
variable="These contents are to be
written to the file"
echo "$variable" > "$file"
这工作得很好。我能够看到文件被写入而不是NULL。但有时在运行此脚本并重新启动后,文件内容将变为NULL。这是为什么发生?
链接到全码:
Newly created file becomes NULL on reboot in Linux
此代码是一个工业移动Linux计算机上运行的非常基本的配置。
显示您的实际shell脚本 –
NULL是什么意思?你如何阅读文件?你在哪里看到NULL? – vojislavdjukic
嗨@AhmedMasud我在这个问题上发布了这个。 https://stackoverflow.com/questions/46612471/newly-created-file-becomes-null-on-reboot-in-linux –