#!/usr/bin/ruby file1 = "/tmp/herbst-padding-1" file2 = "/tmp/herbst-padding-2" pad1 = 'pad 0 0 0 0 0' pad2 = 'pad 0 0 20 0 200' pad3 = 'pad 0 0 0 0 150' files = [file1, file2].map{|f| File.exist? File.expand_path(f)} if files == [false, false] # 0 files system "herbstclient #{pad2}" system "touch #{file1}" elsif files == [true, false] # 1 file system "herbstclient #{pad1}" system "touch #{file2}" else # 2 files system "herbstclient #{pad3}" system "rm #{file1} #{file2}" end