[TriLUG] Single line scripts

Ken MacKenzie via TriLUG trilug at trilug.org
Mon Sep 5 21:01:53 EDT 2016


Yeah my python rdp solution was me keeping the password out of the file
which is needed twice in the correct command.  I set some vars to head it
then prompt for a password and then build the command in a loop so if the
connection drops I can hit r and reconnect quick.

Ken

On Mon, Sep 5, 2016 at 8:50 PM, Aaron Morrison via TriLUG <trilug at trilug.org
> wrote:

>
> Don't forget shell aliases (and in some cases functions)
>
> I have some dozen or so aliases to do some menial jobs that are not
> complicated enough for a script but very tedious to type every time. I keep
> them in my .bashrc file that I have in source control and push to every
> server I have an account for. I also make use of environment variables for
> some of them to be more generic and flexible.  It's simple and I only have
> to maintain one file.
>
> For a similar example, I have an alias named "rdp" that calls
> xfreerdp/rdesktop with all of the needed parameters and pass any arguments
> to the aliased command (such as a hostname)
>
> --am
>
>
> > On Sep 5, 2016, at 20:32, Ken MacKenzie via TriLUG <trilug at trilug.org>
> wrote:
> >
> > Single line scripts.  I will say a script that is effectively used to
> call
> > a long single command line, yeah plenty of times.  I am lazy and
> > forgetful.  The last thing I want to do is type the same thing twice,
> even
> > worse is type it then have to remember later how it is laid out and it is
> > too long ago to up arrow my way to it.  So yeah I make plenty of quick
> > helpers, say to connect to a device for a vnc over ssh tunnel or what not
> > sort packages by install size, you name it.
> >
> > My work's RDP setup uses ts gateway and xfreerdp command line is the only
> > way though it so that is one I used a lot.  It was a single line till I
> > turned it into a quick python program in stead but the point remains.
> >
> > In the end though they are never single line because at the minimum they
> > contain:
> >
> > #!/bin/bash (or /bin/python or /bin/perl or bin/whatever)
> >
> > # why my dumb butt needed to make this
> >
> > cmd....
> >
> > Oh I tend to keep them in under my home, not in a place in the path, and
> I
> > have stopped using extensions (like .sh or ,py) once in a "production"
> > usage.  I just get in the habit of ./something or ~/scripts/something
> when
> > I need to call them.
> >
> > Ken
> > --
> > This message was sent to: Aaron Morrison <ae4ko1 at gmail.com>
> > To unsubscribe, send a blank message to trilug-leave at trilug.org from
> that address.
> > TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> > Unsubscribe or edit options on the web    :
> http://www.trilug.org/mailman/options/trilug/ae4ko1%40gmail.com
> > Welcome to TriLUG: http://trilug.org/welcome
> --
> This message was sent to: Ken M. <ken at mack-z.com>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that
> address.
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web  : http://www.trilug.org/mailman/
> options/trilug/ken%40mack-z.com
> Welcome to TriLUG: http://trilug.org/welcome
>


More information about the TriLUG mailing list