module SystemWithAliases

SystemWithAliases - execute system commands with aliases

SystemWithAliases

Constants

VERSION

Public Class Methods

execute(command) click to toggle source

Execute shell command, Return output, Run with aliases if possible.

# File lib/system_with_aliases.rb, line 24
def self.execute(command)
  expanded_command = expand(command)

  `#{expanded_command}`
end
expand(command, shell = ENV['SHELL']) click to toggle source

Expand command to one that would interpret aliases, If possible.

# File lib/system_with_aliases.rb, line 11
def self.expand(command, shell = ENV['SHELL'])
  if shell =~ /sh/
    "#{shell} -l -c '#{command}' 2>&1"
  else
    "#{command} 2>&1"
  end
end