2

I have a server running an application (puppet) and administration of the server is done almost exclusively with that programs specific commands.

It would be neat to configure the server like a dedicated appliance similar to how a Cisco IOS works with the puppet command.

The puppet command has many arguments many of which also requires elevation so im frequently typing "sudo puppet command subcommand subcommand argument".

I want to be able to type "sudo puppet" and then enter the "puppet" context where I only have to type the top level commands without having to type "sudo puppet command".

Then after I enter the command and I'm in the commands context and I only have to enter the sub command and argument to the subcommand.

Is it clear what I'm trying to accomplish? Is this possible?

1
  • You could use something like read variable && puppet $variable. Dec 5, 2015 at 15:43

1 Answer 1

4

This is actually fairly easy to accomplish, you can use a script like this:

#!/bin/bash
while [ 1 ]; do
    echo -n "puppet> "
    read input
    puppet $input
done

Save with a name like foo.sh, then just run sudo bash foo.sh (or sudo ./foo.sh if you set the executable flag).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .