I am new to Latex, I need to create a user defined command or Macro.
I need to print unix shell commands on a pdf, the code looks like below

```
\begin{lstlisting}[language=bash]
$sudo apt-get install build-essential
\end{lstlisting}

```

This has to be done for every unix command and I have lot too many of them. For this reason I thought I can create a new command called `\shell` like this

```
\newcommand{\shell}[1]{
\begin{lstlisting}[language=bash]
#1
\end{lstlisting}
}

```

I am getting some `!Emergency stop` errors. can someone tell me what am I doing wrong. Thank you.