By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,834 Members | 2,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,834 IT Pros & Developers. It's quick & easy.

Error in perl script.

P: 3
hello,

i have write a script for finding user.my code is look like following.

Expand|Select|Wrap|Line Numbers
  1. #!/usr/local/bin/perl
  2. #
  3. # check whether user is logged on
  4. #
  5.  
  6. if ($#ARGV != 0) {
  7.     print "usage: finduser username\n";
  8.     exit;
  9. }
  10.  
  11. $username = $ARGV[0];
  12. $machines = "insanity ".`systems sgi`;
  13. chop($machines);
  14. @machines = split(/ /,$machines);
  15. @machines = sort(@machines);
  16.  
  17. foreach $machine (@machines) {
  18.  
  19.     if(`rusers $machine | grep $username`) {
  20.     print "$username logged on $machine\n";
  21.     }
  22. }

when i trying to run this script i get 2 errors.the errors are follows.
'systems' is not recognized as an internal or external command,operable program or batch file.
'rusers' is not recognized as an internal or external command,operable program or batch file.

please help me.
Aug 3 '10 #1
Share this Question
Share on Google+
5 Replies


Oralloy
Expert 100+
P: 983
At the risk of sounding flip, I'm pretty sure it means exactly what it says - it can't find your commands "systems" or "rusers".

Can you execute these commands at the command line by yourself? If not, then you will need to adjust your path.

If you can, then there is some disconnect between your path, and the one that the executor under your script uses.
Aug 3 '10 #2

Expert 100+
P: 785
Test whether these two programs "systems" and "rusers" are in the actual path on the unix shell by typing "which systems" (or "whence systems") and "which rusers" (or "whence rusers"). If not, try to find them with "find" and add their path to environment variable PATH. Before running your perl script, type "export PATH".
Aug 3 '10 #3

P: 3
thanks for reply.

i m very new in perl script. i m running this script in windows. and i run both command in command prompt but can't find anything working.

can i set appropriate path in windows. and according to that should i change something in my code ?
Aug 4 '10 #4

Expert 100+
P: 785
There is no command "systems" or "rusers" on windows. I also searched my cygwin installation, it's not there!
I know that "rusers" is a linux command which tells who is logged in to machines on local network.

So you need to research if these commands exist for windows and you can download them, then install them and set your windows environment variable "PATH" to them via "My Computer -> properties -> extension tab".
Or maybe you can rewrite your script and use some other commands that are doing the same and are available in windows.
Aug 4 '10 #5

P: 3
okay, i'll try to search for same.

thanks.. chaarmann, for help !!!
Aug 4 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.