NAME

sshwrap-hostcolor - SSH wrapper script to remember the terminal background you use for each host

VERSION

This document describes version 0.009 of sshwrap-hostcolor (from Perl distribution App-sshwrap-hostcolor), released on 2019-07-26.

SYNOPSIS

Use like you would ssh:

% sshwrap-hostcolor -v ujang@host1.example

For convenience, alias this script to ssh. In your Unix shell:

alias ssh=sshwrap-hostcolor

then you can use it like this:

% ssh -v ujang@host1.example

After you ssh to the remote host, change the background color of your terminal (e.g. to dark blue). Upon exit, the script will retrieve the terminal's current background color and record this line to ~/.sshwrap-hostcolor.history:

ujang@host1.example     00002b

Next time you ssh to the same user@host combination, the script will set the terminal's background color to dark blue.

As a bonus, you can also activate the completion script _sshwrap-hostcolor:

complete -C _sshwrap-hostcolor ssh

this will let you complete user@host and immediately change the background color to the remembered one.

And as another bonus, if you set SSHWRAP_HOSTCOLOR_AUTO to random-dark (or random-light), the script will automatically assign a random color for each unrecognized user+host.

DESCRIPTION

FAQ

The script doesn't work!

To get and set terminal background color programmatically, an xterm-compatible terminal is required. Please see the list here: XTerm::Util.

ENVIRONMENT

SSHWRAP_HOSTCOLOR_AUTO

String. Can be set to random-dark to automatically set the color of a new user+host with a random color between "000000" and "3f3f3f". Can be set torandom-light to automatically set the color of a new user+host with a random color between "c0c0c0" and "ffffff".

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-sshwrap-hostcolor.

SOURCE

Source repository is at https://github.com/perlancar/perl-App-sshwrap-hostcolor.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-sshwrap-hostcolor

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

ssh

Some video demonstrations: one, two, three.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019, 2018 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.