-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> "Ian" == Ian Flanigan <[EMAIL PROTECTED]> writes:
>>>>> "Kai" == Kai Gro�johann <[EMAIL PROTECTED]> writes:

Ian> If you wanted to be wicked-gross, you could look for perl and do:

Ian> perl -e 'print "uid=$> euid=$< groups=$( egroups=$)\n";'

Kai> Please note that the problem is to find out the numeric user id
Kai> for a given user name.

Perl makes that just as easy.  I presume Python and many other
scripting langs do as well -- though I imagine 'twould be best to
limit oneself to interpreters which accept an arg a la Perl's -e....

        perl -e 'print getpwnam("username")."\n"'

which may be better written as:

        perl -e 'print scalar(getpwnam("username")),"\n"'

or as:

        perl -e 'print (getpwnam("username"))[2],"\n"'

Use getgrnam and "groupname" for converting group names to gids.

Another solution would be to write a one-liner which is the functional
equivalent of the invocation of (the instance of) ls(1) you prefer.

I bet Perl would be up to that task....

And by using one-liners, you needn't leave any droppings behind on the
remote box.

Of course, if the shell's input buffer is too small for a given NQaOL
(think Sellers and diamonds :), just dump the script to perl's STDIN
and get the result from its STDOUT.

P.S.    Couldn't resist.  Perl is fun.  Elisp is fun.  Mixing the
        two *must* :) be a blast.

- -JimC
- -- 
James H. Cloos, Jr.  <http://www.jhcloos.com/public_key> 1024D/ED7DAEA6 
<[EMAIL PROTECTED]>  E9E9 F828 61A4 6EA9 0F2B  63E7 997A 9F17 ED7D AEA6
        Save Trees:  Get E-Gold! <http://www.jhcloos.com/go?e-gold>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v0.9.11 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE34FtNmXqfF+19rqYRAg+jAKCOL1xaIfjfZAiy1nIux+SC5wGD7gCgv+hz
vSF97NuqjXV/5SmHAXrjkY8=
=62Za
-----END PGP SIGNATURE-----

Reply via email to