[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: commands within shell script



On Tue, 2003-03-04 at 20:41, Nori Heikkinen wrote:
> on Tue, 04 Mar 2003 05:13:33PM -0500, Benjamin Rutt insinuated:
> > Nori Heikkinen <nori@sccs.swarthmore.edu> writes:
> > > okay, this is cool ... i'd just misunderstood a friend's question.
> > > he doesn't even want to run top, he wants to stick in a bunch of
> > > echo statements.
> > 
> > In that case, place 'set -x' as the 2nd line of the shell script
> > (the line after the #! business) and see every command echoed as it
> > is executed.  -- Benjamin
> 
> *exactly* what i(/he) wanted!  thanks!

Try this:
#!/bin/bash
set -x
set -v
for i in 1 2 3 4 5;
do
    echo foobar${i} ;
done

After seeing Benjamin Rutt mention "-x", I tried it along with "-v",
and having both makes it much easier to see the flow of the script.

-- 
+-----------------------------------------------------------+
| Ron Johnson, Jr.     Home: ron.l.johnson@cox.net          |
| Jefferson, LA  USA   http://members.cox.net/ron.l.johnson |
|                                                           |
| The difference between Rock&Roll and Country Music?       |
| Old Rockers still on tour are pathetic, but old Country   |
| signers are still great.                                  |
+-----------------------------------------------------------+



Reply to: