Re: OT: shell scripts and spaces in file/folder names
hi ya joris
On Thu, 17 Apr 2003, Joris Huizer wrote:
> I now wrote a very small script which will convert
> every space in the name into a '-'
> ----
>
> #!/bin/sh
>
> for i in *
> do
> #echo "mv \""$i"\" `echo "$i" |sed -e 's/\ /-/' -
> `"
> mv "$i" `echo ` "$i" | sed -e 's/\ /-/' - `
you have an xtra ` after echo or a missing ` at the end or ?
you probably want to do s/\s+/-/g instead
c ya
alvin
and for more (annoying) fun try:
touch /tmp/"bad boy; me 2! junk here" ; touch /tmp/"bad john's docs"
( makes your bash shell go bonkers
( and you cannot control how windoze users names their files
to clean up the mess ( assuming there are no real files named bad* )
rm -i /tmp/bad*
Reply to: