ps -ef | grep hoge | grep -v grep
Doing like this gives the same result.
ps -ef | grep [h]oge
Because regexp like /[h]oge/ matches "*hoge*" and does not match "[h]hoge" that is the argument of grep command.
seratch's programming memo
ps -ef | grep hoge | grep -v grep
ps -ef | grep [h]oge
use Perl6::Say;
my @array = qw( hoge foo var );
say @array + 0;
say $#array + 1;
say scalar(@array);
my $target = 'abcbac#ok#dddse';
my $regexp = '#(.+?)#';
*regexp_p = sub { $_[0] =~ m/$_[1]/; defined $1 and print $1; };
regexp_p($target, $regexp);
undef *regexp_p;
sub regexp_p_sub {
my $target = shift;
my $regexp = shift;
$target =~ m/${regexp}/;
defined $1 and print $1;
}
*regexp_p = \®exp_p_sub;
regexp_p($target, $regexp);
sub make_glob {
no strict 'refs';
*{ $_[0] } = sub { $_[0] =~ m/$_[1]/; defined $1 and print $1; };
}
make_glob('regexp_p');
regexp_p($target, $regexp);
my $input = 0;
my $flag = $input || 1;
my $input = 0;
my $flag = defined $input ? $input : 1;
package Foo;
use base qw( Class::Accessor::Fast );
__PACKAGE__->mk_accessors( qw( name ) );
package Foo::Var;
use base qw/ Foo /;
__PACKAGE__->mk_accessors( qw( birthday ) );
* getter
$self->get('KEY'), $self->KEY
* setter
$self->set('KEY', 'something new')
__PACKAGE__->follow_best_practice;
:;wp!