taking backup en getting info about it

I want to write a script that tells me if the tape device is ready, if the answer is not yes ($?is not 0) i get an answer that the tape_device is not ready. If the tape is ready i can do a
tar -cvf $tape1 * .
How can i write a script to control if the tapedevice is ready or not?

How can i write a script so i get an output on a file that tells me how many files are backup-ed.

i thought about the commands
tar -tvf $tape1 > mylist
and then do the command wc -l mylist
but how can i put the output into a variable for exemple $Mynumber, i thought about the command 'read 'but i dont know how to write it

Check the man page on mt for controlling the tape drive and checking to see if it's available.

As far as the setting a variable, it matters which shell you are using.

i thought about the commands
tar -tvf $tape1 > mylist
and then do the command wc -l mylist
but how can i put the output into a variable for exemple $Mynumber

In csh - set Mynumber =`wc -l mylist`