# HG changeset patch # User Davor Ocelic # Date 1557172709 -7200 # Node ID a6c211de24f0d85519d402f7d556343d856508fe # Parent 2d7f16eff198eda056be8e6250ee9cf66bf9a000 Support separating aliases by space too diff -r 2d7f16eff198 -r a6c211de24f0 shelldap --- a/shelldap Mon May 06 21:11:13 2019 +0200 +++ b/shelldap Mon May 06 21:58:29 2019 +0200 @@ -1578,8 +1578,8 @@ } return - # If there is argument but without =, user wanted to print specific alias - } elsif($cmd_alias !~ /=/ and !@_) { + # If there is argument but without = or space, user wanted to print specific alias + } elsif($cmd_alias !~ /[=\s]/ and !@_) { my $alias = $cmd_alias; my $cmd_args = $conf->{alias}{$alias}; unless( $cmd_args) { @@ -1591,9 +1591,13 @@ # There is argument with =, so the line is a new alias definition } else { - my($alias, $command) = split /=/, $cmd_alias, 2; + my($alias, $command) = ($cmd_alias =~ m/^(\S+?)[=\s]?(.*)$/); + unless( $alias) { + print "Invalid syntax.\n"; + return + } $command = $cmd_map{$command}[0] if $cmd_map{$command} and $cmd_map{$command}[0]; - $conf->{alias}{$alias} = [ $command, @_ ]; + $conf->{alias}{$alias} = [ $command ? $command : (), @_ ]; } }