るりまサーチ

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

別のキーワード

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

ライブラリ

検索結果

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

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

...成します。
コマンドが無い場合は、Shell.def_system_command などであらかじめ作成します.

@
param alias エイリアスの名前を文字列で指定します.

@
param command コマンド名を文字列で指定します.

@
param opts 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) -> () (6119.0)

commandのaliasを削除します.

....

@
param alias 削除したいエイリアスの名前を文字列で指定します。

@
raise NameError alias で指定したコマンドが無い場合に発生します。

使用例: 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("lsla")
begin
Shell
.unalias_command("lsla")
rescue NameError => err
puts err
end...