#!/import/bw/tools/local/perl-5.8.0/bin/perl eval 'exec /import/bw/tools/local/perl-5.8.0/bin/perl -S $0 ${1+"$@"}' if 0; # not running under some shell # # psh - Perl Shell # # Copyright (C) 1999-2003 Gregor N. Purdy. All rights reserved. # This script is free software. It may be copied or modified according # to the same terms as Perl itself. # package Psh; # still use a package so getopt etc. is not imported into # the shell namespace use Psh; require Psh::Locale; require Psh::Util; # # Parse the command line and deal with the options except -r, which is # handled in the MAIN program below. We do this part very early in this # file so that the results apply to all the setting up we do before the # MAIN program. # # option -i is ignored @Psh::origINC=@INC; # save it my %opt=(); if (@ARGV) { require Getopt::Std; Getopt::Std::getopts('Fiwrd:f:c:', \%opt); if ($opt{'r'}) { Psh::Util::print_error_i18n('no_r_flag'); exit 1; } # # -w is "warnings mode": # if ($opt{'w'}) { Psh::Util::print_out_i18n('simulate_perl_w'); $^W = 1; use strict; } # # -d is "debug mode": # if (exists($opt{'d'})) { $Psh::debugging = $opt{'d'}||'soie'; } else { $Psh::debugging = 0; } } Psh::Util::print_debug("Debugging!\n"); Psh::minimal_initialize; Psh::process_rc($opt{'f'}) unless $opt{'F'}; Psh::finish_initialize; # TODO: Is this implementation equivalent to sh's ? if($opt{'c'}) { Psh::evl($opt{'c'}); exit 0; } if (@ARGV) { Psh::process_args; } else { Psh::initialize_interactive_mode; while (1) { eval { Psh::main_loop; }; Psh::handle_message($@,'main_loop'); } } exit 0;