【发布时间】:2013-12-26 02:50:05
【问题描述】:
我的代码出现以下错误。
ruby -w search.rub search.rub:19:警告:'end' 处的缩进与 12 处的'case' 不匹配 search.rub:62: 语法错误,意外的 $end,需要关键字 end
我有一种感觉,它与所有的目的有关。
#!/usr/bin/ruby
num_line = 0
NumDiccionario = 1
def checkPassword (pass)
print pass, "\t"
system("bitcoind", "walletpassphrase", pass, "20")
case $?.exitstatus
when 0
puts "You found it!#{pass}"
File.open('password.txt', 'w') do |file|
file.puts phrase + "\n"
end
exit 0
end
str_num_line = "0"
File.open('lastLine.txt', 'r') do |file2|
str_num_line = file2.gets
end
if (str_num_line.to_i > 0 )
print "Last searching stopped at line " + str_num_line + "\n"
STDOUT.flush
print "Continue from here? y/n:"
resp = gets.chomp
if (resp == "y")
num_line =str_num_line.to_i
end
end
【问题讨论】:
-
非常感谢任何帮助,我丢失了一个非常重要文件的密码,这个 ruby 脚本似乎正是我所需要的。
-
应该是整个脚本,当我删除最后一个'end'时,我得到 search.rub:61: syntax error, unexpected $end, expecting keyword_end
-
您的 case 语句缺少
end关键字。 -
哇,非常感谢你们!我真的很感激,现在一切都很好。
标签: ruby