Returns the login name of the owner of the current process.
This S-Lang function returns the user name of the
owner of the current process. Since the function does
not take any arguments it does not need to be
called as "username()".
chips> vmessage("The username is %s",username)
The username is ciaouser
chips> !who am i
ciaouser pts/1 Jun 18 21:00 (chandra.cfa.harvard.edu)
Here we show username() being called from ChIPS.
require("varmm");
vmessage("The username is %s",username);
() = system("who am i");
This is the same as the previous example but
written as a S-Lang script. If save to the
file uname.sl then it can be run using:
and should produce the same output (bar differences in
the time) to the ChIPS version.
Note that the syntax and output of the UNIX "who" command
is system specific - we have used the Solaris 2.8
version in these examples.
|