script "echo on" like MS-DOS?

Ask a Question related to FreeBSD, Design and Development.

  1. #1

    Default script "echo on" like MS-DOS?

    Is there a simple way to cause a shell script to echo to the terminal
    similar to the old MS-DOS "echo on" command?

    I've tried to read the fine man pages, and even tried looking at for
    instance the make scripts that seem to echo their commands to the
    terminal, but I couldn't even being to follow them.

    Thanks,

    Christopher Kelley

    Christopher Kelley Guest

  2. Similar Questions and Discussions

    1. #39195 [Opn->Bgs]: if (0=="any sting") echo "it's return true";
      ID: 39195 Updated by: derick@php.net Reported By: waynewn at citiz dot net -Status: Open +Status: ...
    2. #39195 [NEW]: if (0=="any sting") echo "it's return true";
      From: waynewn at citiz dot net Operating system: win/freebsd PHP version: 5.1.6 PHP Bug Type: Scripting Engine problem Bug...
    3. "Devel::DProf" on a PERL script uses "Test::More"
      Dear all, I encountered a problem while run profiling on a script which uses "Test::More". May I ask whether anybody have some idea or wrap...
    4. #26162 [NEW]: $a="0abcdefg";if ($a==0) echo "OK"; result is "OK" ?!
      From: zhuminglun at yahoo dot com dot cn Operating system: linux/win2000 PHP version: 4.3.4 PHP Bug Type: *General Issues...
    5. #26162 [Opn->Bgs]: $a="0abcdefg";if ($a==0) echo "OK"; result is "OK" ?!
      ID: 26162 Updated by: didou@php.net Reported By: zhuminglun at yahoo dot com dot cn -Status: Open +Status: ...
  3. #2

    Default Re: script "echo on" like MS-DOS?

    On Tue, Feb 22, 2005 at 11:32:17PM -0800, Christopher Kelley 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?
    >
    > I've tried to read the fine man pages, and even tried looking at for
    > instance the make scripts that seem to echo their commands to the
    > terminal, but I couldn't even being to follow them.
    The answer to that depends entirely on which shell is being used, as it
    is the shell itself that will have to do the echoing.

    One solution that seems to work for all of /bin/sh, bash, and zsh is to
    invoke the shell with the -x flag. Then the shell will echo each
    command before executing it.

    For other shells there may, or may not be an equivalent.


    --
    <Insert your favourite quote here.>
    Erik Trulsson
    [email]ertr1013@student.uu.se[/email]
    Erik Trulsson Guest

  4. #3

    Default Re: script "echo on" like MS-DOS?

    On Tuesday 22 February 2005 11:32 pm, Christopher Kelley 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?
    on the first line have #! /bin/sh -x

    or type

    /bin/sh -x <script>

    -x also does the same thing for csh scripts.

    This might not be what you want, but it's the closest thing I can think of to
    "echo on"
    >
    > I've tried to read the fine man pages, and even tried looking at for
    > instance the make scripts that seem to echo their commands to the
    > terminal, but I couldn't even being to follow them.
    >
    > Thanks,
    >
    > Christopher Kelley
    >
    > _______________________________________________
    > [email]freebsd-questions@freebsd.org[/email] mailing list
    > [url]http://lists.freebsd.org/mailman/listinfo/freebsd-questions[/url]
    > To unsubscribe, send any mail to
    > "freebsd-questions-unsubscribe@freebsd.org"
    Matt Navarre Guest

  5. #4

    Default Re: script "echo on" like MS-DOS?

    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.

    Giorgos Keramidas Guest

  6. #5

    Default Re: script "echo on" like MS-DOS?

    Giorgos Keramidas wrote:
    >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):
    >
    >
    Thanks. Yes, I'm using sh, I forgot to mention that. That's exactly
    what I was looking for!

    Christopher

    Christopher Kelley Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139