Skip to content

Instantly share code, notes, and snippets.

@chad
Created October 8, 2013 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chad/6886103 to your computer and use it in GitHub Desktop.
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

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