Posted By

noah on 01/09/09


regex Shell script ruby howto tricks slice

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


How to find the path to the script that is currently executing

 / Published in: Ruby


I just realized this kind of regex operation is done with slice in Ruby. In Perl that would be

print 'path/to/file' =~ m{(.*/)};
  1. puts $0.slice(/.*\//)

Report this snippet  

You need to login to post a comment.