Expect Terminal Macros

Hey people!

I just started out working at an ISP as tech support and thought that I should ease the work load by scripting some small macros.

I create different commands with Alias through .bashrc which are all directed to the same script file. Here I planned on using Expect to run different input macros. Problem i came across though is that I can't set a varible to the command i ran to execute the script file.

So i .bashrc i have written
alias command2="~/scirpt.file"

and in script.file i have made the different rules for each command.

An easy solution to the problem would be to create one script file for each command, but that isn't as neat, easpesially not if I want to distribute the script to my collegues.

What i need in script.file is a line that sets a variable to the command that I have inputed so i can create an if-statement for which action that should be taken.

so if i have the terminal like this.

ghettofish@server:~$ command2

then i should go to script.file and have a statement that does the following.

set input_command [code to retrive command that executed the script.file]

Then later i could create an if-statement that would be something like
if ($input_command == "command2") blah blah

Anyone got any ideas?
Hope someone could help me out with this.