So im trying to rename all files in a directory, so that they do not have spaces. Im doing a bash script and im really not sure what to do, i've tried all kinds of quotes and escaping but im not sure what combo could work.#!/bin/bash#change empty spaces in filenames to underlineoslsarray=$(echo $(pwd)/*)for i in $lsarraydo    if [[ $i == * * ]]     then        line=$(echo $i | sed 's/ \+/\_/g')        j=$(echo $i | sed 's/ \+/\\ /g')        mv $j $line        echo $i        echo $j        echo $line        fidonesince mv needs special variable expansion im using double quotes on it. Any tips appreciated.
How to replace the spaces in filenames with underscore
bash;shell script;sed