On Sun, Nov 06, 2022 at 08:50:16PM +0800, jeremy ardley wrote: > On 6/11/22 19:38, Thomas Schmitt wrote: > > Then unpack the archive files: > > > > for i in "$archive_dir"/*.afio.bz2 > > do > > # One of: > > # afio -ivZ -P bzip2 > Corrected: > > afio -ivZ -P bzip2 $i > > > # bunzip2 < "$i" | afio -iv - > > done
The "$i" needs to be "double-quoted", or else it will fail on files that have whitespace or globbing characters in their names. You may think "Well that's irrelevant, because I don't have any files like that", but it's a good habit to develop. Playing bash-ian roulette with unquoted variable expansions *will* eventually hurt you.