running commands from script

I'm new to unix and I have a fairly simple problem:

Lets say I am in a specific directory and I run the command: "dirs" ,

I get an output of all the folders that i pushed into the stack (as expected),
buut,
when when I create a script (called test):

#! /bin/csh

dirs

and then i run: ./test

It outputs only the last directory that I pushed into the stack (as opposed to the whole stack).For some reason the Script does'nt recognize the stack that I have in the prompt.

whyyy?? Pleeaase help

I think that when you run the script, you are creating a new process for which the directory stack is empty. Try using pushd in the script before you run the 'dirs' command.

I am new to Linux. I am tring to write a bash shell script. Can someone tell me the proper steps input data to "VI" so that I can execute my script.

Thank In Advance.