Quote All Variables #17

Open
opened 2026-02-02 15:21:58 -05:00 by jared · 0 comments
Owner

Bad:

for disk in $(lsblk -d -o name | grep -E '^sd|^nvme'); do

Good:

while IFS= read -r disk; do
-z "$disk" && continue
done < <(lsblk -d -o name | grep -E '^sd|^nvme')

# Bad: for disk in $(lsblk -d -o name | grep -E '^sd|^nvme'); do # Good: while IFS= read -r disk; do [[ -z "$disk" ]] && continue done < <(lsblk -d -o name | grep -E '^sd|^nvme')
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/proxDoc#17