Skip to content

Instantly share code, notes, and snippets.

@chad
Created October 8, 2013 15:00
Show Gist options
  • Select an option

  • Save chad/6886103 to your computer and use it in GitHub Desktop.

Select an option

Save chad/6886103 to your computer and use it in GitHub Desktop.
Bash and Ruby file/directory manipulation
require 'fileutils'
Dir.mkdir("hello") unless Dir.exist?("hello")
FileUtils.mkdir_p("/tmp/foo/bar/baz/this/is/easy/no")
Dir["/etc/**/*"].each { |f| puts IO.readlines(f).grep(/chad/i) rescue nil}
if [ ! -d "hello" ] ; then
mkdir "hello"
fi
mkdir -p /tmp/foo/bar/baz/this/is/easy/too
find /etc/ -exec grep -i chad {} \; 2>/dev/null
@parkr
Copy link
Copy Markdown

parkr commented Oct 8, 2013

get the SHELL out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment