我刚刚安装了 Fedora 33 的新实例,并通过compress=zstd:3挂载选项为我的根卷启用了压缩。我启用了 的/usr压缩chattr +x /usr。
我想禁用/var目录压缩,根据https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5)#FILE_ATTRIBUTES我应该能够使用chattr +X /var,但 F33 的工具不理解这一点选项。在https://btrfs.wiki.kernel.org/index.php/Compression中有一个命令btrfs property set /var compression "",但我无法判断这是否有效。我的文件系统上的任何文件都没有设置“压缩”属性,这没有意义。
我假设 btrfs 在使用compress选项安装时默认自动压缩所有文件,但默认情况下它看起来只压缩显+c式设置(“压缩”)标志的文件和目录。
unset myVariable i;
while [ -z "$i" ]; do
read myVariable;
echo "myVariable : '$myVariable'";
i=foo;
done;
echo "myVariable : '$myVariable'"
Run Code Online (Sandbox Code Playgroud)
(unset是否允许重播命令)
按任意键 + ENTER,你会得到:
myVariable : '[what you typed]'
myVariable : '[what you typed]'
Run Code Online (Sandbox Code Playgroud)
的值myVariable存在于while循环之外。现在尝试:
tmpFile=$(mktemp);
echo -e 'foo\nbar\nbaz' >> "$tmpFile"
while read myVariable; do
otherVariable=whatever;
echo "myVariable : '$myVariable', otherVariable : '$otherVariable'";
done < "$tmpFile";
echo "myVariable : '$myVariable', otherVariable : '$otherVariable'";
rm "$tmpFile"
Run Code Online (Sandbox Code Playgroud)
你会得到 :
myVariable : 'foo', otherVariable : 'whatever' …Run Code Online (Sandbox Code Playgroud)