[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Temporary color prompt in bash script



On Tue 03 Sep 2019 at 15:07:43 (+0000), Larry Dighera wrote:
>  On Mon, 02 Sep 2019 08:48:50 +0200, Computer Planet
> 
> <debian@cpnetserver.net> wrote:
> 
> >Is It possible to print of a string at the exit of a bash script?
> 
> Have a look at `man bash` and search for 'trap.'

Trap is designed to break the sequential flow of commands.
I can't see any reason to do that when the OP wants the
sequence:

    execute a script
    print a string

>  trap [-lp] [[arg] sigspec ...]
>               The command arg is to be read and executed when the
> shell receives signal(s) sigspec.  If arg is absent
>               (and  there  is a single sigspec) or -, each specified
> signal is reset to its original disposition (the

If you make your screen narrow before you cut and paste, you won't end
up with this mess, but something instead like:

       trap [-lp] [[arg] sigspec ...]
              The command arg is to  be  read  and
              executed  when  the  shell  receives
              signal(s) sigspec.  If arg is absent
              (and  there  is a single sigspec) or
              -, each specified signal is reset to
              its  original disposition (the value
              it had upon entrance to the  shell).

Cheers,
David.


Reply to: