Skip to content

Commit 3364054

Browse files
andy5995claude
andcommitted
test: fix shellcheck warnings in test_btrfs_clone.sh
- Use grep -q instead of comparing output with [ -z/n .. ] (SC2143) - Quote $(id -u) to prevent word splitting (SC2046) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ebe9502 commit 3364054

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/test_btrfs_clone.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ if [ ! -d "$BTRFS_MOUNTPOINT" ]; then
1919
sudo mkdir "$BTRFS_MOUNTPOINT"
2020
fi
2121

22-
if [ -z "$(mount | grep rmw-btrfs)" ]; then
22+
if ! mount | grep -q rmw-btrfs; then
2323
sudo mount -o loop "$BTRFS_IMAGE" "$BTRFS_MOUNTPOINT"
24-
sudo chown $(id -u) -R "$BTRFS_MOUNTPOINT"
24+
sudo chown "$(id -u)" -R "$BTRFS_MOUNTPOINT"
2525
fi
2626

2727
cd "$BTRFS_MOUNTPOINT"
@@ -109,7 +109,7 @@ test -f foo
109109

110110
cd
111111

112-
if [ -n "$(mount | grep rmw-btrfs)" ]; then
112+
if mount | grep -q rmw-btrfs; then
113113
sudo umount "$BTRFS_MOUNTPOINT"
114114
fi
115115

0 commit comments

Comments
 (0)