basename with spaces in a bash script?
I'm working on a bash script to create a new folder in /tmp/ using the name of a file, and then copy the file inside that folder.

	#!/bin/bash

	MYBASENAME="`basename $1`"
	mkdir "/tmp/$MYBASENAME"

	for ARG in "$@"
		do
			mv "$ARG" "/tmp/$MYBASENAME"

	done

Behavior:

When I type in `mymove "/home/me/downloads/my new file.zip"` it shows this:


	mkdir /tmp/my
	new
	file.zip
	mv: rename /home/me/downloads/my new file.zip to /tmp/my\nnew\nfile.zip:

I have lots of quotes around everything, so I don't understand why this is not working as expected.

Also, I have the form loop in there in case there are multiple files. I want them all to be copied to the same folder, based on the first argument's basename.


basename with spaces in a bash script?
===

I'm working on a bash script to create a new folder in /tmp/ using the name of a file, and then copy the file inside that folder.

	#!/bin/bash

	MYBASENAME="`basename $1`"
	mkdir "/tmp/$MYBASENAME"

	for ARG in "$@"
		do
			mv "$ARG" "/tmp/$MYBASENAME"

	done

Behavior:

When I type in `mymove "/home/me/downloads/my new file.zip"` it shows this:


	mkdir /tmp/my
	new
	file.zip
	mv: rename /home/me/downloads/my new file.zip to /tmp/my\nnew\nfile.zip:

I have lots of quotes around everything, so I don't understand why this is not working as expected.

Also, I have the form loop in there in case there are multiple files. I want them all to be copied to the same folder, based on the first argument's basename.

