# $Release Version: 0.6.0 $
# $Date: 2001/03/19 09:01:11 $
# by Keiju ISHITSUKA(Nippon Rational Inc.)
require "shell/command-processor"
require "shell/process-controller"
@RCS_ID='-$Id: shell.rb,v 1.8 2001/03/19 09:01:11 keiju Exp keiju $-'
extend Exception2MessageMapper
# debug: true -> normal debug
# debug: 1 -> eval definition debug
# debug: 2 -> detail inspect debug
def default_system_path=(path)
@default_system_path = path
def default_record_separator
if @default_record_separator
@default_record_separator
def default_record_separator=(rs)
@default_record_separator = rs
@system_path = Shell.default_system_path
@record_separator = Shell.default_record_separator
@command_processor = CommandProcessor.new(self)
@process_controller = ProcessController.new(self)
attr :record_separator, true
attr_reader :command_processor
attr_reader :process_controller
File.expand_path(path, @cwd)
# Most Shell commands are defined via CommandProcessor
# Shell#cwd/dir/getwd/pwd
# If called as iterator, it restores the current directory when the
notify "current dir: #{@cwd}"
notify "dir stack: [#{@dir_stack.join ', '}]"
notify "dir stack: [#{@dir_stack.join ', '}]"
notify "dir stack: [#{@dir_stack.join ', '}]"
@process_controller.kill_job(sig, command)
def Shell.def_system_command(command, path = command)
CommandProcessor.def_system_command(command, path)
def Shell.undef_system_command(command)
CommandProcessor.undef_system_command(command)
def Shell.alias_command(ali, command, *opts, &block)
CommandProcessor.alias_command(ali, command, *opts, &block)
def Shell.unalias_command(ali)
CommandProcessor.unalias_command(ali)
def Shell.install_system_commands(pre = "sys_")
CommandProcessor.install_system_commands(pre)
if debug.kind_of?(Integer) && debug > 2
def self.notify(*opts, &block)
if opts[-1].kind_of?(String)
CommandProcessor.initialize
CommandProcessor.run_config