\lstset{language=csh,showstringspaces=false,basicstyle=\footnotesize}
\begin{lstlisting}
#!/bin/csh
if ( $#argv < 2 ) then
echo "usage: $0 name age"
exit 1
endif
\end{lstlisting}
However, the "#" seems to cause the formating to break - the rest of the
line is slanted and "then" is not bold. If I remove the "#" everything
looks fine. I couldn't find anything about this in the documentation.
The listings package probably thinks that the # starts a comment here. I have no idea at the moment except for trying a different pretty-printer like Pygments.
The line is displaying in italics because the hash mark indicates that the line is a comment.
If you really want to redefine how the language is displayed, I know a way to do it but it takes some work. I tried putting the override in the document itself, but it seems that the listings.sty package wants the definition in a file, so here is what I did.
1) I wrote a new language definition by copying the csh style from texmf-dist/tex/latex/listings/lstlang1.sty. I put this definition in its own .sty file called lstlangbob.sty. If you have never done this, then there are extra instructions...
A) locate your TEXMFLOCAL directory by running:
texconfig conf
and then looking for for a line in the output that starts with "TEXMFLOCAL".
B) Go to the TEXMFLOCAL directory, then go into or create a subdirectory: tex/latex/local
C) in that tex/latex/local subdirectory, create a file called lstlanbob.sty (or whatever you want) and paste this into it:
2) your document should look something like this if you want all occurrences of the csh listings to look the same. Otherwise you can switch between the csh style and the cshX style that I created.
\begin{document}
\begin{frame}[fragile]
here is a listing of a shell script:
\begin{lstlisting}
#!/bin/csh
if ( $#argv < 2 ) then
echo "usage: $0 name age"
exit 1
endif
\end{lstlisting}
\end{frame}
\end{document}