Bash: loop through file names with spaces








#!/bin/bash

IFS_BAK=$IFS
IFS=$(echo -en "\n\b")
for f in $(ls)
do
  echo "$f"
done
IFS=$IFS_BAK



No comments:

Post a Comment