#!/usr/bin/perl use strict; use warnings; # simple_shell # This script is just an example of a very simple "shell" program. # Cameron Hayne (macdev@hayne.net) December 2005 my $version = 0.01; # Functions #-------------------------------- sub print_help() { print < "; } MAIN { print "Welcome to ss (Simple Shell) version $version\n", "Type: help for help\n"; print_prompt(); while (<>) { chomp; my $cmd = $_; if ($cmd =~ /^\s*help\s*$/) { print_help(); } elsif ($cmd =~ /^\s*exit\s*$/) { exit; } elsif ($cmd =~ /^\s*ls\s*$/) { system("ls"); } elsif ($cmd =~ /^\s*easter egg\s*$/) { system("open http://www.bigthings.ca/alberta/pictures/egg1.jpg"); } else { print "Command not recognized\n"; } print_prompt(); } }