Guest User

loc

a guest
Mar 6th, 2016
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.47 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use utf8;
  3. $| = 1;
  4. binmode(STDOUT, ":utf8");
  5. binmode(STDIN, ":utf8");
  6.  
  7. exit unless $ARGV[0];
  8.  
  9. $pwd = `pwd`;
  10. chomp $pwd;
  11. my $command;
  12. if($ARGV[1]) {
  13.     $command = shift @ARGV;
  14. }
  15. $pwd = $pwd . '/' . $ARGV[0];
  16. my $orig = $pwd;
  17. $pwd =~ s/(.*public_html\/)(.*)/$2/;
  18. if($command eq 'link') {
  19.     utf8::decode($pwd);
  20.     system(qq{echo 'http://$pwd' | xclip -i});
  21. } else {
  22.     print $orig, "\n" unless $ARGV[1];
  23.     utf8::decode($pwd);
  24.     print "http://$pwd\n";
  25. }
Add Comment
Please, Sign In to add comment