Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Apr 2017 11:43:47 -0700
From:      Chuck Swiger <cswiger@mac.com>
To:        Ernie Luzar <luzar722@gmail.com>
Cc:        FreeBSD current <freebsd-current@freebsd.org>
Subject:   Re: csh script help
Message-ID:  <427BD3AE-6619-4E3A-BFE7-32882B46921D@mac.com>
In-Reply-To: <58F115A8.8010407@gmail.com>
References:  <58F0D301.7000509@gmail.com> <9A420780-8DEB-4FBA-9CDE-A9E152110E38@mac.com> <58F115A8.8010407@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi--

On Apr 14, 2017, at 11:32 AM, Ernie Luzar <luzar722@gmail.com> wrote:
> Chuck Swiger wrote:
>> On Apr 14, 2017, at 6:47 AM, Ernie Luzar <luzar722@gmail.com> wrote:
>>> To aid in debugging the script I'm writing, I place "echo" commands =
throughout so I can kind of have a trace of the logic as different =
conditions are processed. Normally I just delete these "echo" commands =
after I get the script working.
>>=20
>> Since you've gotten an answer to the question you asked, let me only =
note that both sh and csh support the -x flag, which causes the shell to =
echo the commands as it runs.  This is extremely helpful for debugging.
>> Regards,
>=20
> Where is the this -x flag coded at?  Do the executed lines roll fast =
off the screen or can I slowly step through the script a line at a time?
>=20
> Thanks for this bit of information.

You can either run the script via "/bin/sh -x myscript.sh" and similar =
for csh, or you can add -x to the first line of the script, commonly "#! =
/bin/sh" and invoke it directly via ./myscript.sh.

The lines are displayed as rapidly as the shell runs.

If running natively on FreeBSD, most people would use a terminal =
emulator like xterm which provides scrollback.  You could also run under =
nohup, which will save output to a file named nohup.out, unless you =
redirect output somewhere else.

Regards,
--=20
-Chuck




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?427BD3AE-6619-4E3A-BFE7-32882B46921D>