Skip to content

Commit

Permalink
fix shell escaping issues
Browse files Browse the repository at this point in the history
  • Loading branch information
trapd00r committed Dec 1, 2011
1 parent 40d5934 commit 672638f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ls++
@@ -1,7 +1,7 @@
#!/usr/bin/perl
my $APP = 'ls++';
use vars qw($VERSION);
$VERSION = '0.346';
$VERSION = '0.348';

use strict;
use Term::ExtendedColor qw(fg uncolor);
Expand Down Expand Up @@ -555,9 +555,8 @@ sub isa_tty {
sub get_ls_where {
my @files;
for(@_) {
$_ =~ s/\s/\\ /g;
if(-e $_) {
push(@files, $_);
push(@files, escape($_));
}
else {
push(@ls_opts, $_);
Expand All @@ -578,6 +577,11 @@ sub get_ls_cmdline {
'--time-style=+%s ' . join('', @ls_opts);
}

sub escape {
my $p = shift;
$p =~ s/([;<>*|`&\$!#()[\]{}:'" ])/\\$1/g;
return $p;
}

sub get_os {
return $^O;
Expand Down

0 comments on commit 672638f

Please sign in to comment.