script "echo on" like MS-DOS?

Giorgos Keramidas keramida at ceid.upatras.gr
Wed Feb 23 07:50:28 GMT 2005


On 2005-02-22 23:32, Christopher Kelley <bsd at 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.



More information about the freebsd-questions mailing list