Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hermansc
Created September 9, 2013 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hermansc/6501296 to your computer and use it in GitHub Desktop.
Save hermansc/6501296 to your computer and use it in GitHub Desktop.
itkadduser
#! /usr/bin/perl
use strict;
use warnings;
use ITK::usermod;
my $host = "login.stud.ntnu.no";
my $user = $ENV{'SUDO_USER'} // $ENV{'LOGNAME'};
if (not $user) {
$user = ITK::usermod::prompt("Brukernavn på lynx")
}
my $cmd = "finger $user | sed -e '/Name/!d;s/.*: //'";
my $output = `ssh $user\@$host "$cmd"`;
chomp($output);
print "Name: $output\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment