#!/bin/bash # This script changes the filename of every *.jpg file # to replace spaces with underscores. Although, spaces # are legal, modern web browsers do not unescape them, so # filenames continaing spaces become less readable. for filename in $* ; do without=`echo $filename | tr ' ' _ ` if test "$filename" != "$without" ; then mv "$filename" "$without" fi done