Skip to content

Instantly share code, notes, and snippets.

@vyder
Last active August 29, 2015 14:09
Show Gist options
  • Save vyder/4d375d59daff5e58b02b to your computer and use it in GitHub Desktop.
Save vyder/4d375d59daff5e58b02b to your computer and use it in GitHub Desktop.
A ~/bin script to pre-create a ruby script and open it in nano
filename=$1
touch $filename
cat <<EOM > $filename
#!/usr/bin/env ruby
EOM
chmod +x $filename
nano +3 $filename

~/Code: nr test

Opens:

  GNU nano 2.0.6                  File: test

#!/usr/bin/env ruby

<cursor here>

Once you're done typing your ruby code, you can use ^O + ^X to write and quit the file.

Then you're ready to execute the script already:

~/Code: ./test

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