mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Initial revision
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
392296c12d
commit
3db12e8b23
225 changed files with 75935 additions and 0 deletions
44
sample/io.rb
Normal file
44
sample/io.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
# IO test
|
||||
# usage: ruby io.rb file..
|
||||
|
||||
home = ENV["HOME"]
|
||||
home.sub("m", "&&")
|
||||
print(home, "\n")
|
||||
print(home.reverse, "\n")
|
||||
|
||||
if File.s("io.rb")
|
||||
print(File.s("io.rb"), ": io.rb\n")
|
||||
end
|
||||
|
||||
$/="f\n"
|
||||
for i in "abc\n\ndef\nghi\n"
|
||||
print("tt: ", i)
|
||||
end
|
||||
|
||||
printf("%s:(%d)%s\n", $0, ARGV.length, ARGV[0])
|
||||
passwd = open(ARGV[0], "r")
|
||||
#printf("%s", passwd.find{i|i =~ /\*/})
|
||||
|
||||
n = 1
|
||||
for i in passwd #.grep(/^\*/)
|
||||
printf("%6d: %s", n, i)
|
||||
n = n + 1;
|
||||
end
|
||||
|
||||
fp = open("|-", "r")
|
||||
|
||||
if fp == nil
|
||||
for i in 1..5
|
||||
print(i, "\n")
|
||||
end
|
||||
else
|
||||
for line in fp
|
||||
print(line)
|
||||
end
|
||||
end
|
||||
|
||||
def printUsage()
|
||||
if $USAGE
|
||||
apply($USAGE);
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue