>>12
を、Ruby で作ってみた

ext = ".zip" # 拡張子

# 行末の改行を削除して、1行ずつ処理する
File.foreach( "input.txt", chomp: true ) do |full_path|
next unless File.directory? full_path # 存在するディレクトリだけを処理する

# 例えば、/a/b/c/ なら、/a/b, c に分割する
dir_name, base_name = File.split( full_path )
zip_name = base_name + ext

Dir.chdir( dir_name ) do
# p Dir.pwd # カレントディレクトリ
p cmd = "zip -r #{ zip_name } #{ base_name }"
# `#{ cmd }` # コマンド実行
end
end

出力
"zip -r test.zip test"
"zip -r ruby.zip ruby"