The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
#!/usr/local/bin/perl -w


use Getopt::Declare;

my $shell_cmds = <<'EOCMDS';
Commands: [repeatable]

	echo [-n] <words:/.*/>	ECHO WITHOUT NEWLINE 
			{ print $words; print "\n" unless $_PUNCT_{'-n'}; }

	[pvtype: chwho /u?g?a?/]
	[pvtype: chwhat /r?w?x?/]

	chmod [-R] <who:chwho>=<what:chwhat> <files>...	
				CHANGE FILE PERMISSIONS 
			{ foreach (@files) { print "chmod $who=$what $_\n"; }
			}

	help			SHOW THIS SUMMARY 
			{ $self->usage() }

	exit			EXIT SHELL 
			{ exit }

	<error:/.*/>	 
			{ print "Unknown command: $error\n";
			  print "(Try the 'help' command?)\n"; }
EOCMDS

my $shell = new Getopt::Declare ($shell_cmds,[-BUILD]);

my $count = 1;
sub prompt { print "$count> "; $count++; return <STDIN> }

$shell->parse(\&prompt);