Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Feb 2005 09:49:41 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Christopher Kelley <bsd@kelleycows.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: script "echo on" like MS-DOS?
Message-ID:  <20050223074941.GA687@gothmog.gr>
In-Reply-To: <421C3181.9020004@kelleycows.com>
References:  <421C3181.9020004@kelleycows.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-02-22 23:32, Christopher Kelley <bsd@kelleycows.com> wrote:
> Is there a simple way to cause a shell script to echo to the terminal
> similar to the old MS-DOS "echo on" command?

You can do similar things with the set -x option of sh(1):

% gothmog:/tmp$ cat echo.sh
% #!/bin/sh
%
% set -x
% ls /tmp
% set +x
% echo no echo
% ls /tmp
% gothmog:/tmp$ sh echo.sh
% + ls /tmp
% echo.sh         screens         ssh-6OYAaVIB9P
% + set +x
% no echo
% echo.sh         screens         ssh-6OYAaVIB9P
% gothmog:/tmp$

Note how the commands after set -x are echoed.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050223074941.GA687>