<p>I need to rearrange some content in various directories but it's a bit of a pain. In order to debug the application I'm working on (a ruby app) I need to move my gems into my gem folder one at a time (long story; nutshell: one is broken and I can't figure out which one).</p>

<p>So I need to do something like:</p>

<pre><code>sudo mv backup/gem/foo gem/
sudo mv backup/doc/foo doc/
sudo mv backup/specification/foo.gemspec specification/
</code></pre>

<p>replacing "foo" each time. How can I author a simple shell script to let me do something like: gemMove("foo") and it fill in the blanks for me?</p>

Put the following into a file named
```
gemmove
```
:
```
```
#!/bin/bash

if [ "x$1" == x ]; then
  echo "Must have an arg"
  exit 1
fi

for d in gem doc specification ; do 
  mv "backup/$d/$1" "$d"
done
```
```
then do
```
```
chmod a+x gemmove
```
```
and then call
```
sudo /path/to/gemmove foo
```
to move the foo gem from the backup dirs into the real ones