script "echo on" like MS-DOS?

Giorgos Keramidas keramida at
Wed Feb 23 07:50:28 GMT 2005

On 2005-02-22 23:32, Christopher Kelley <bsd at> 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
% #!/bin/sh
% set -x
% ls /tmp
% set +x
% echo no echo
% ls /tmp
% gothmog:/tmp$ sh
% + ls /tmp
%         screens         ssh-6OYAaVIB9P
% + set +x
% no echo
%         screens         ssh-6OYAaVIB9P
% gothmog:/tmp$

Note how the commands after set -x are echoed.

More information about the freebsd-questions mailing list