barbara to Linux · 8 months agowhy does noone inprove bash such that you can write a normal foor loop with whitespace in file names?message-squaremessage-square45fedilinkarrow-up131arrow-down117file-text
arrow-up114arrow-down1message-squarewhy does noone inprove bash such that you can write a normal foor loop with whitespace in file names?barbara to Linux · 8 months agomessage-square45fedilinkfile-text
minus-squarebizdelnicklinkfedilinkarrow-up5·8 months agotouch a b c 'd e f' 'g h i' for f in *; do ls -la "$f"; done fxd
minus-squareGenderNeutralBro@lemmy.sdf.orglinkfedilinkEnglisharrow-up6·8 months agoThat will work in either zsh or bash, yes. It’s a good habit to use quotes, but I am pointing out that quoting and expansion behavior is not the same across all shells.
minus-squarebizdelnicklinkfedilinkarrow-up7arrow-down1·8 months agoIt’s the same across all POSIX compliant shells. zsh is not POSIX compliant.
touch a b c 'd e f' 'g h i' for f in *; do ls -la "$f"; done
fxd
That will work in either zsh or bash, yes. It’s a good habit to use quotes, but I am pointing out that quoting and expansion behavior is not the same across all shells.
It’s the same across all POSIX compliant shells.
zsh
is not POSIX compliant.