るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.033秒)
トップページ > クエリ:new[x] > クエリ:alias_command[x]

別のキーワード

  1. psych alias
  2. rdoc/alias alias
  3. module alias_method
  4. alias anchor
  5. alias anchor=

ライブラリ

クラス

検索結果

Shell.alias_command(alias, command, *opts) {...} -> self (18113.0)

コマンドの別名(エイリアス)を作成します。 コマンドが無い場合は、Shell.def_system_command などであらかじめ作成します.

...を指定します.

使用例: ls -la | sort -k 5 のような例。

require 'shell'
Shell.def_system_command("ls")
Shell.alias_command("lsla", "ls", "-a", "-l")
Shell.def_system_command("sort")
sh = Shell.new
sh.transact {
(lsla | sort("-k 5")).each {|l|
puts l
}
}...

Shell.unalias_command(alias) -> () (6112.0)

commandのaliasを削除します.

....def_system_command("ls")
Shell.alias_command("lsla", "ls", "-a", "-l")
Shell.def_system_command("sort")
sh = Shell.new
sh.transact {
(lsla | sort("-k 5")).each {|l|
puts l
}
}
Shell.unalias_command("lsla")
begin
Shell.unalias_command("lsla")
rescue NameError => err...