I generally don't deal with scripting outside of Batch (and even that's a little hazy after all these years) and i've never dealt with Linux. Luckily, it looks very similar to batch, so i'll give it a shot, but you'll potentially need to correct folder locations and check the syntax.
This is what i assume is the problem. As others said, you've not created the variable "location1". Typically in 'system scripting' language, variables are assigned like this;
To use the variable, something like this;
For example, if you wanted to set a location variable called 'location1' to '/root/michael/store' (this is just an assumption), you'd have this;
and to echo that to screen;
To use a variable in any way, it's literally adding a dollar sign ($) before the name of the variable you wish to use.
This is a basic definition and is fairly universal. Programming isn't much different, but i won't go into that here as it's not the subject.
I'd guess the second part (after 'else' is where the problem lies). Step by step, you're;
1 - Setting the directory
2 - Calling the restore command with '$2'
3 - Setting the filename variable to `basename "$restore"`
4 - Attepting to move/mv the file specified in step 3 from "location1" to $location, telling it to prompt before overwrite
To me, there's one main problem; "$location". You've not specified in the script what that is and you're trying to move files there. Usage of mv according to research shows something like this;
Traditionally, you might enclose source and destination in speech marks ("Source" "Destination") unless it's a variable to form something like this;
mv [flags] Source Destination
From that last line of the script, it's like it's looking for the directory "location1" inside $filename.
mv -i $filename $location
I'm not sure if this will fix it (and i'm not responsible if it messes anything up or simply doesn't work, use at your own risk);
You might also want to look at that last mv line in the original script you posted. Is there not meant to be a slash somewhere in there? I'm not sure whether you want to move from $filename/"location1" to $location, or from $filename to "location1"/$location. That alone would probably cause the script to bug out, but combined with the variable(s) you were missing, i'd hazard it's simply not knowing what you're intending to actually move.
if [ "$1" == "-n" ]
restore`grep "$2" /root/michael/store`
echo "Where would you like to save the file?"
location1=`readlink -f "$location"`
mv -i $filename "location1"/filename
restore=`grep "$2" /root/michael/store`
mv -i $filename "location1" $location
Again, it's all guesswork, but i believe that's the issue.