commandline session $cat var Name=Jeffrin Age=36 $echo $Name $. var $echo $Name Jeffrin $echo $Age 36 $./var bash: ./var: Permission denied $chmod 744 var $./var $echo $Age 36 $bash $echo $Name $./var $echo $Name $. var $echo $Name Jeffrin $ls -l var -rwxr–r– 1 jeffrin jeffrin 20 Apr 10 00:41 var $
Author Archives: jeffrin
some useful /proc parameters
commandline session root>cat /proc/sys/fs/file-max 198152 root>cat /proc/sys/net/ipv4/ip_forward 0 root>cat /proc/sys/dev/cdrom/autoeject 0 root>cat /proc/sys/dev/scsi/logging_level 0 root>cat /proc/sys/kernel/hostname debian root>cat /proc/sys/kernel/osrelease 3.2.0-4-amd64 root>cat /proc/sys/net/core/rmem_max 131071 root>cat /proc/sys/vm/laptop_mode 0 root>cat /proc/sys/vm/swappiness 60 root>
help Get Help for Shell Builtins
commandline session $help source source: source filename [arguments] Execute commands from a file in the current shell. Read and execute commands from FILENAME in the current shell. The entries in $PATH are used to find the directory containing FILENAME. If any ARGUMENTS are supplied, they become the positional parameters when FILENAME is executed. Exit Status: …
TYPE COMMAND Indicate how a command name is interpreted
commandline session $type ls ls is aliased to `ls –color=auto’ $type cp cp is /bin/cp $type mv mv is /bin/mv $type happy bash: type: happy: not found $type gnome-session gnome-session is /usr/bin/gnome-session $type rm rm is /bin/rm $type rm -r rm is /bin/rm bash: type: -r: not found $type ‘rm -r’ bash: type: rm -r: …
Continue reading “TYPE COMMAND Indicate how a command name is interpreted”
nl [ -i ] line number increment at each line
commandline session $cat comma.pl use strict; use warnings; for (qw/ 179550 45960 890458 -12345678 1000000000000/) { (my $n = $_) =~ s/(d+?)(?=(d{3})+b)/$1,/g; print “$nn”; } $nl comma.pl 1 use strict; 2 use warnings; 3 for (qw/ 179550 45960 890458 -12345678 1000000000000/) { 4 (my $n = $_) =~ s/(d+?)(?=(d{3})+b)/$1,/g; 5 print “$nn”; 6 } $nl …
Continue reading “nl [ -i ] line number increment at each line”
PERL @ (at sign) and ARRAY
commandline session $cat array.pl #!/usr/bin/perl use strict; use warnings; my @colors = (“red”,”green”,”blue”); print “@colors”; print “n”; $perl array.pl red green blue $vim array.pl $cat array.pl #!/usr/bin/perl use strict; use warnings; my @colors = (“red”,”green”,”blue”); print “@colors”; print “n”; print $color[0]; print “n”; $perl array.pl Global symbol “@color” requires explicit package name at array.pl line …
Perl TESTING for gcc compiler option related
commandline session $cat testgcc.pl #!/usr/bin/perl -w use Test::More tests => 2 ; my $result; system “gcc unsigned.c”; $result = `./a.out`; #print $result; ok ($result lt 0); system “gcc -funsigned-char unsigned.c”; $result = `./a.out`; #print $result; ok ($result gt 0); $cat unsigned.c #include int main(void) { char c = -10; printf(“%d”,c); return 0; } $perl testgcc.pl …
Continue reading “Perl TESTING for gcc compiler option related”
PERL TESTING Print only ok/not ok
commandline session $cat test5.pl #!/usr/bin/perl use strict; use warnings; my $result; $result = `/usr/bin/concalc 1 + 1`; print $result; if ( $result == 1 ) { print “okn”; } else { print “not okn”; } $result = `/usr/bin/concalc 2 + 2`; if ( $result == 4 ) { print “okn”; } else { print “not …
Perl Testing using system function
commandline session $cat test4.pl #!/usr/bin/perl use strict; use warnings; system “echo 1 > 1”; print “n”; system “echo 2 > 2”; print “n”; system “echo hello”; print “n”; $perl test4.pl hello $cat 1 1 $cat 2 2 $
TEST WITH Perl extension for ICalendar date objects
commandline session $cat test3.pl #!/usr/bin/perl -w use Test::Simple tests => 2; use Date::ICal; my $ical = Date::ICal->new; # create an object ok( defined $ical ); # check that we got something ok( $ical->isa(‘Date::ICal’) ); # and it’s the right class $perl test3.pl 1..2 ok 1 ok 2 $