Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Going from UNIX TRU64 to REDHAT 5.3 1

Status
Not open for further replies.

ejaggers

Programmer
Feb 26, 2005
148
US
Need Help With A Few Linux Commands:

T64:
more xxx - clears the screen and displays file xxx, but does not return to the command line until I enter space or CR.

RH:
How do I get more on Linux to wait on me? If xxx is less than a screen, more displays and returns to cmd prompt w/o waiting. I'm using system(more xxx) in Perl but not seeing the display.

T64:
logon as xyz and su
echo $USER I get root

RH:
logon as xyz and su
echo $USER I get xyz, unless I su -
I use $ENV{USER} in Perl scripts and I'm not getting root.
 
You could use less instead of more, which always displays an END prompt, but may be confusing for users because it requires a "q" to quit. In which case you prefer the less -e behaviour.

The whoami command may be a more portable way to do that, however in PERL you should probably use the built-in function getlogin().



Annihilannic.
 
Annihilannic, Thanks for the tip on less. Howerever, about the problem with REDHAT not knowing the user.
I login as xzy and then su (not su -) to root, getlogin() in the perl script prints xyz (RH & Unix). But whoami does work on both.
 
Sorry, I must have screwed up my testing. :)

Try this too:

Code:
use POSIX;
print getpwuid(geteuid()) . "\n";

Note that getpwuid() returns a list of values, here I'm just using the first one in scalar context.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top