Created
October 8, 2013 15:00
-
-
Save chad/6886103 to your computer and use it in GitHub Desktop.
Bash and Ruby file/directory manipulation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
commented
Oct 8, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment