Skip to content

Instantly share code, notes, and snippets.

@SteveBenner
Last active August 29, 2015 14:00
Show Gist options
  • Save SteveBenner/11134391 to your computer and use it in GitHub Desktop.
Save SteveBenner/11134391 to your computer and use it in GitHub Desktop.
Simple script that generates executable shortcuts from the command line
#!/usr/bin/env ruby
#
# Shortcuttr - generates executable shortcuts
#
require 'fileutils'
SCRIPT = File.join ENV['HOME'], 'github/ruby-scripts/system/bin', ARGV.first.to_s
File.open SCRIPT, 'w', 0755 do |f|
f.puts '#!/usr/bin/bash'
f.puts '# This executable shortcut was generated by Stephen Benner, a truly lazy programmer'
f.puts ARGV[1].to_s
end
FileUtils.symlink SCRIPT, File.join('/usr/local/bin', ARGV.first.to_s), verbose: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment