Failing to write retrieve script for tape to disk conversion

I have the below script which has been written to retrieve files from tape drive i.e. TSM server. Now i have to write the script using UNIX commands for retrieve operation but I am not able to proceed. The script is:

#!/usr/local/bin/expect -f
set timeout 1800
set file [lindex $argv 0]
spawn $env(SHELL)
match_max 100000
log_file /home/series/apple/retrieve.log
send_log "\n\n===========================================================================\n\n"
expect -exact "\$ "
send -- "/usr/bin/dsmc rest -replace=N -optfile=/usr/lpp/adsm/bin/dsm_gold.opt $file\r"
expect {
timeout {send_log "\ntimed out waiting for TSM file restore";exit 99}
"Select an appropriate action" {send -- "A\r"}
"Restore processing finished." {send -- "\rexit\r";exit 0}
"exists, skipping" {send -- "\rexit\r";exit 0}
"No file specification entered" {send_log "\nNo file specification passed to script\n";exit 99}
"No objects on server match query" {send_log "\nNo file matches found on TSM\n";expect -exact "\$";send -- "echo \"Failed to restore $file since it was not found on the media\" | mail -s \"Apple-Testing Restore Alert-Not Found\" hrsaurav@gmail.com\r";expect -exact "\$"; exit 99}
}
expect {
timeout { send_log "\ntimed out waiting for TSM response";exit 99}
"ANS1074W" {expect -exact "\$";send -- "echo \"Failed to restore $file due to permissions \" | mail -s \"Apple-Testing Restore Alert-Permissions\" hrsaurav@gmail.com\r" ;exit 99}
}
expect -exact "\$ "
send -- "exit\r"
expect eof

Please advise and let me know in case you need any information.