Skip to content

Instantly share code, notes, and snippets.

@esmarkowski
Created January 9, 2012 14:58
Show Gist options
  • Save esmarkowski/1583277 to your computer and use it in GitHub Desktop.
Save esmarkowski/1583277 to your computer and use it in GitHub Desktop.
def run_if_present( path )
puts "if [ -d #{path} ]; then #{yield self}; fi"
end
my_pid_file = "/somewhere/secret"
run_if_present my_pid_file do
"ls #{my_pid_file}"
end
run_if_present(my_pid_file){ "ls #{my_pid_file}" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment