1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/doc/shell.rd.jp

337 lines
7.2 KiB
Text
Raw Normal View History

-- shell.rb
$Release Version: 0.6.0 $
$Revision$
$Date$
by Keiju ISHITSUKA(keiju@ishitsuka.com)
=begin
= <20><>Ū
ruby<EFBFBD><EFBFBD><EFBFBD><EFBFBD>sh/csh<73>Τ<CEA4>˥<EFBFBD><CBA5>ޥ<EFBFBD><DEA5>ɤμ¹Եڤӥե<D3A5><D5A5>륿<EFBFBD><EBA5BF><EFBFBD>󥰤<EFBFBD><F3A5B0A4><EFBFBD><EFBFBD>ڤ˹Ԥ<CBB9>.
sh/csh<73><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>ruby<62>ε<EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD>Ѥ<EFBFBD><D1A4>Ƽ¸<C6BC><C2B8><EFBFBD><EFBFBD><EFBFBD>.
= <20><><EFBFBD>ʥ<EFBFBD><CAA5><EFBFBD><E9A5B9><EFBFBD><EFBFBD>
== Shell
Shell<EFBFBD><EFBFBD><EFBFBD>֥<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥϥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥǥ<EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɼ¹ԤϤ<D4A4><CFA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>Хѥ<EFBFBD><EFBFBD>ˤʤ<EFBFBD><EFBFBD>ޤ<EFBFBD>.
--- Shell#cwd
--- Shell#dir
--- Shell#getwd
--- Shell#pwd
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E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FBD><CAA4>Ȥ<EFBFBD>ľ<EFBFBD>ܼ¹ԤǤ<D4A4><C7A4><EFBFBD>Shell#system<65><6D><EFBFBD>ޥ<EFBFBD><DEA5>ɤ⤢<C9A4><E2A4A2><EFBFBD>ޤ<EFBFBD>.
--- Shell.def_system_command(command, path = command)
Shell<6C>Υ<CEA5>åɤȤ<C9A4><C8A4><EFBFBD>command<6E><64><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD>ޤ<EFBFBD>.
<20><>)
Shell.def_system_command "ls"
ls <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Shell.def_system_command "sys_sort", "sort"
sort<72><74><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD>sys_sort<72>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
--- Shell.undef_system_command(command)
command<6E><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD>.
--- Shell.alias_command(ali, command, *opts) {...}
command<6E><64>alias<61>򤷤ޤ<F2A4B7A4>.
<20><>)
Shell.alias_command "lsC", "ls", "-CBF", "--show-control-chars"
Shell.alias_command("lsC", "ls"){|*opts| ["-CBF", "--show-control-chars", *opts]}
--- Shell.unalias_command(ali)
command<6E><64>alias<61><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD>.
--- Shell.install_system_commands(pre = "sys_")
system_path<74><68><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥμ¹Բ<C2B9>ǽ<EFBFBD>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Shell<6C><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><E1A5BD>
<20><>̾<EFBFBD>ϸ<E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BD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>.
--- Shell#kill sig, job
job<6F>˥<EFBFBD><CBA5><EFBFBD><EFBFBD>ʥ<EFBFBD>sig<69><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
== <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥǥ<C8A5><C7A5><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD>
--- Shell#cd(path, &block)
--- Shell#chdir
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥǥ<C8A5><C7A5><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD>path<74>ˤ<EFBFBD><CBA4><EFBFBD>. <20><><EFBFBD>ƥ졼<C6A5><ECA1BC><EFBFBD>Ȥ<EFBFBD><C8A4>ƸƤФ줿<D0A4>Ȥ<EFBFBD><C8A4>ˤ<EFBFBD>
<20>֥<EFBFBD><D6A5>å<EFBFBD><C3A5>¹<EFBFBD><C2B9><EFBFBD><EFBFBD>Τߥ<CEA4><DFA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥǥ<C8A5><C7A5><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD>.
--- Shell#pushd(path = nil, &block)
--- Shell#pushdir
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥǥ<C8A5><C7A5><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD>ǥ<EFBFBD><C7A5><EFBFBD>ȥꥹ<C8A5><EAA5B9><EFBFBD>å<EFBFBD><C3A5>ˤĤ<CBA4>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥǥ<C8A5><C7A5>
<20>ȥ<EFBFBD><C8A5><EFBFBD>path<74>ˤ<EFBFBD><CBA4><EFBFBD>. path<74><68><EFBFBD><EFBFBD>ά<EFBFBD><CEAC><EFBFBD>줿<EFBFBD>Ȥ<EFBFBD><C8A4>ˤ<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥǥ<C8A5><C7A5><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD>
<20>ǥ<EFBFBD><C7A5><EFBFBD>ȥꥹ<C8A5><EAA5B9><EFBFBD>å<EFBFBD><C3A5>Υȥåפ<C3A5><D7A4>򴹤<EFBFBD><F2B4B9A4><EFBFBD>. <20><><EFBFBD>ƥ졼<C6A5><ECA1BC><EFBFBD>Ȥ<EFBFBD><C8A4>ƸƤФ줿<D0A4><ECA4BF>
<20><><EFBFBD>ˤ<EFBFBD>, <20>֥<EFBFBD><D6A5>å<EFBFBD><C3A5>¹<EFBFBD><C2B9><EFBFBD><EFBFBD>Τ<EFBFBD>pushd<68><64><EFBFBD><EFBFBD>.
--- Shell#popd
--- Shell#popdir
<20>ǥ<EFBFBD><C7A5><EFBFBD>ȥꥹ<C8A5><EAA5B9><EFBFBD>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݥåפ<C3A5>, <20><><EFBFBD><EFBFBD><EFBFBD>򥫥<EFBFBD><F2A5ABA5><EFBFBD><EFBFBD>ȥǥ<C8A5><C7A5><EFBFBD>ȥ<EFBFBD><C8A5>ˤ<EFBFBD><CBA4><EFBFBD>.
== <20>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD>/<2F>ǥ<EFBFBD><C7A5><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD>
--- Shell#foreach(path = nil, &block)
path<74><68><EFBFBD>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD>, File#foreach
path<74><68><EFBFBD>ǥ<EFBFBD><C7A5><EFBFBD>ȥ<EFBFBD><C8A5>ʤ<EFBFBD>, Dir#foreach
--- Shell#open(path, mode)
path<74><68><EFBFBD>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD>, File#open
path<74><68><EFBFBD>ǥ<EFBFBD><C7A5><EFBFBD>ȥ<EFBFBD><C8A5>ʤ<EFBFBD>, Dir#open
--- Shell#unlink(path)
path<74><68><EFBFBD>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD>, File#unlink
path<74><68><EFBFBD>ǥ<EFBFBD><C7A5><EFBFBD>ȥ<EFBFBD><C8A5>ʤ<EFBFBD>, Dir#unlink
--- Shell#test(command, file1, file2)
--- Shell#[command, file1, file2]
<20>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>ȴؿ<C8B4>test<73><74>Ʊ<EFBFBD><C6B1>.
<20><>)
sh[?e, "foo"]
sh[:e, "foo"]
sh["e", "foo"]
sh[:exists?, "foo"]
sh["exists?", "foo"]
--- Shell#mkdir(*path)
Dir.mkdir<69><72>Ʊ<EFBFBD><C6B1><><CAA3><EFBFBD><EFBFBD>)
--- Shell#rmdir(*path)
Dir.rmdir<69><72>Ʊ<EFBFBD><C6B1><><CAA3><EFBFBD><EFBFBD>)
== <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɼ¹<C9BC>
--- System#system(command, *opts)
command<6E><64><EFBFBD>¹Ԥ<C2B9><D4A4><EFBFBD>.
<20><>)
print sh.system("ls", "-l")
sh.system("ls", "-l") | sh.head > STDOUT
--- System#rehash
<20><><EFBFBD>ϥå<CFA5><C3A5><EFBFBD><E5A4B9>
--- Shell#transact &block
<20>֥<EFBFBD><D6A5>å<EFBFBD><C3A5><EFBFBD><EFBFBD>Ǥ<EFBFBD>shell<6C><6C>self<6C>Ȥ<EFBFBD><C8A4>Ƽ¹Ԥ<C2B9><D4A4><EFBFBD>.
<20><>)
sh.transact{system("ls", "-l") | head > STDOUT}
--- Shell#out(dev = STDOUT, &block)
transact<63><74><EFBFBD>ƤӽФ<D3BD><D0A4><EFBFBD><EFBFBD>η<EFBFBD><CEB7>̤<EFBFBD>dev<65>˽<EFBFBD><CBBD>Ϥ<EFBFBD><CFA4><EFBFBD>.
== <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD>
--- Shell#echo(*strings)
--- Shell#cat(*files)
--- Shell#glob(patten)
--- Shell#tee(file)
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ¹Ԥ<C2B9><D4A4><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƤȤ<C6A4><C8A4><EFBFBD>Filter<65><72><EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4>֤<EFBFBD><D6A4>ޤ<EFBFBD>.
--- Filter#each &block
<20>ե<EFBFBD><D5A5>륿<EFBFBD>ΰ<EFBFBD><CEB0>Ԥ<EFBFBD><D4A4>Ĥ<EFBFBD>block<63><6B><EFBFBD>Ϥ<EFBFBD>.
--- Filter#<(src)
src<72><63><EFBFBD>ե<EFBFBD><D5A5>륿<EFBFBD><EBA5BF><EFBFBD><EFBFBD><EFBFBD>ϤȤ<CFA4><C8A4><EFBFBD>. src<72><63>, ʸ<><CAB8><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><CAA4>Хե<D0A5><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, IO<49>Ǥ<EFBFBD><C7A4><EFBFBD>
<20>Ф<EFBFBD><D0A4><EFBFBD><EFBFBD>򤽤Τޤ<CEA4><DEA4><EFBFBD><EFBFBD>ϤȤ<CFA4><C8A4><EFBFBD>.
--- Filter#>(to)
src<72><63><EFBFBD>ե<EFBFBD><D5A5>륿<EFBFBD>ν<EFBFBD><CEBD>ϤȤ<CFA4><C8A4><EFBFBD>. to<74><6F>, ʸ<><CAB8><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><CAA4>Хե<D0A5><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, IO<49>Ǥ<EFBFBD><C7A4><EFBFBD>
<20>Ф<EFBFBD><D0A4><EFBFBD><EFBFBD>򤽤Τޤ޽<DEA4><DEBD>ϤȤ<CFA4><C8A4><EFBFBD>.
--- Filter#>>(to)
src<72><63><EFBFBD>ե<EFBFBD><D5A5>륿<EFBFBD><EBA5BF><EFBFBD>ɲä<C9B2><C3A4><EFBFBD>. to<74><6F>, ʸ<><CAB8><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><CAA4>Хե<D0A5><D5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, IO<49>Ǥ<EFBFBD><C7A4><EFBFBD><EFBFBD><EFBFBD>
<20><><EFBFBD><EFBFBD><EFBFBD>򤽤Τޤ޽<DEA4><DEBD>ϤȤ<CFA4><C8A4><EFBFBD>.
--- Filter#|(filter)
<20>ѥ<EFBFBD><D1A5>׷<EFBFBD><D7B7><EFBFBD>
--- Filter#+(filter)
filter1 + filter2 <20><> filter1<72>ν<EFBFBD><CEBD>Ϥθ<CFA4>, filter2<72>ν<EFBFBD><CEBD>Ϥ<EFBFBD><CFA4>Ԥ<EFBFBD>.
--- Filter#to_a
--- Filter#to_s
== <20>ȹ<EFBFBD><C8B9>ߥ<EFBFBD><DFA5>ޥ<EFBFBD><DEA5><EFBFBD>
--- Shell#atime(file)
--- Shell#basename(file, *opt)
--- Shell#chmod(mode, *files)
--- Shell#chown(owner, group, *file)
--- Shell#ctime(file)
--- Shell#delete(*file)
--- Shell#dirname(file)
--- Shell#ftype(file)
--- Shell#join(*file)
--- Shell#link(file_from, file_to)
--- Shell#lstat(file)
--- Shell#mtime(file)
--- Shell#readlink(file)
--- Shell#rename(file_from, file_to)
--- Shell#split(file)
--- Shell#stat(file)
--- Shell#symlink(file_from, file_to)
--- Shell#truncate(file, length)
--- Shell#utime(atime, mtime, *file)
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>File<6C><65><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD>Ʊ̾<C6B1>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD>åɤ<C3A5>Ʊ<EFBFBD><C6B1><EFBFBD>Ǥ<EFBFBD>.
--- Shell#blockdev?(file)
--- Shell#chardev?(file)
--- Shell#directory?(file)
--- Shell#executable?(file)
--- Shell#executable_real?(file)
--- Shell#exist?(file)/Shell#exists?(file)
--- Shell#file?(file)
--- Shell#grpowned?(file)
--- Shell#owned?(file)
--- Shell#pipe?(file)
--- Shell#readable?(file)
--- Shell#readable_real?(file)
--- Shell#setgid?(file)
--- Shell#setuid?(file)
--- Shell#size(file)/Shell#size?(file)
--- Shell#socket?(file)
--- Shell#sticky?(file)
--- Shell#symlink?(file)
--- Shell#writable?(file)
--- Shell#writable_real?(file)
--- Shell#zero?(file)
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FileTest<73><74><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD>Ʊ̾<C6B1>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD>åɤ<C3A5>Ʊ<EFBFBD><C6B1><EFBFBD>Ǥ<EFBFBD>.
--- Shell#syscopy(filename_from, filename_to)
--- Shell#copy(filename_from, filename_to)
--- Shell#move(filename_from, filename_to)
--- Shell#compare(filename_from, filename_to)
--- Shell#safe_unlink(*filenames)
--- Shell#makedirs(*filenames)
--- Shell#install(filename_from, filename_to, mode)
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FileTools<6C><73><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD>Ʊ̾<C6B1>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD>åɤ<C3A5>Ʊ<EFBFBD><C6B1><EFBFBD>Ǥ<EFBFBD>.
<20><><EFBFBD><EFBFBD>¾, <20>ʲ<EFBFBD><CAB2>Τ<EFBFBD><CEA4>Τ<EFBFBD><CEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAA5A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD>.
--- Shell#cmp <- Shell#compare
--- Shell#mv <- Shell#move
--- Shell#cp <- Shell#copy
--- Shell#rm_f <- Shell#safe_unlink
--- Shell#mkpath <- Shell#makedirs
= <20><><EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD>
== ex1
sh = Shell.cd("/tmp")
sh.mkdir "shell-test-1" unless sh.exists?("shell-test-1")
sh.cd("shell-test-1")
for dir in ["dir1", "dir3", "dir5"]
if !sh.exists?(dir)
sh.mkdir dir
sh.cd(dir) do
f = sh.open("tmpFile", "w")
f.print "TEST\n"
f.close
end
print sh.pwd
end
end
== ex2
sh = Shell.cd("/tmp")
sh.transact do
mkdir "shell-test-1" unless exists?("shell-test-1")
cd("shell-test-1")
for dir in ["dir1", "dir3", "dir5"]
if !exists?(dir)
mkdir dir
cd(dir) do
f = open("tmpFile", "w")
f.print "TEST\n"
f.close
end
print pwd
end
end
end
== ex3
sh.cat("/etc/printcap") | sh.tee("tee1") > "tee2"
(sh.cat < "/etc/printcap") | sh.tee("tee11") > "tee12"
sh.cat("/etc/printcap") | sh.tee("tee1") >> "tee2"
(sh.cat < "/etc/printcap") | sh.tee("tee11") >> "tee12"
== ex4
print sh.cat("/etc/passwd").head.collect{|l| l =~ /keiju/}
=end