Skip to content

Commit

Permalink
ruby version of perl 2 dir prompt script
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk luesebrink committed Apr 13, 2011
1 parent b1179ef commit 465002b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions script/c2prompt.rb
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby

puts ENV['PWD']

__END__

sub main {

my @av = @_;

$home = $ENV{HOME};
$pwd = $ENV{PWD};
#print "arg: $pwd\n";
$pwd =~ s!($home)!~!;
$npwd = $pwd;

$pwd =~ m!([^/]*/[^/]*$)! and do {
$npwd = $1;
#print "1: '$1'\n";
};

print "$npwd";
}

main( @ARGV);

#end of file

0 comments on commit 465002b

Please sign in to comment.