1. #!/usr/bin/perl -w
2. # Shell coded by Douglas[at]WeakNetLabs[dot]com
3. #
4. my $hostname = "celeritas";
5. my @apps = ('help', 'quit', 'clear', 'exit', 'hostname');
6. print "\n" x 100;
7. &shell;
8.
9. sub shell {
10. print $hostname . "> ";
11. $cmd = <STDIN>;
12. chomp $cmd;
13. @spltcmd = split(/\s/, $cmd);
14. $cmd_input = $spltcmd[0];
15. if (!grep(/$cmd_input/, @apps)) {
16. print "\n$cmd_input: Command not yet implemented\n";
17. &shell;
18. }else { $cmd_input .= "_im"; &$cmd_input; }
19. }
20. sub help_im {
21. print "This is Help!\n";
22. &shell;
23. }
24. sub exit_im {
25. print "Goodbye!\n";
26. exit;
27. }
28. sub quit_im {
29. print "Goodbye!\n";
30. exit;
31. }
32. sub clear_im {
33. print "\n" x 100;
34. &shell;
35. }
36. sub hostname_im {
37. $hostname = $spltcmd[1];
38. print "Changed hostname to $spltcmd[1]" . "." . "\n";
39. &shell;
40. }