perl -e 'for(1..12){my $dir=sprintf("%02i ",$_);mkdir"2005/$dir"}'
A place for John to record his techy notes, both to refer back to when needed, and as a help for others...
Saturday, October 29, 2005
Making a list of directories with perl...
Thursday, October 20, 2005
vi move line
<ESC>:11m32<Enter>
will move line 11 to 32. :o)
(works in standard vi too)
<ESC>:11,15m32<Enter>
works too...
*just* found it by accident after all these years!
(thanks vim command history so I could see what I typed instead of 11,32!!!)
will move line 11 to 32. :o)
(works in standard vi too)
<ESC>:11,15m32<Enter>
works too...
*just* found it by accident after all these years!
(thanks vim command history so I could see what I typed instead of 11,32!!!)
Wednesday, October 19, 2005
Perl conditional (colon) operator.
printf "I have %d camel%s.\n", $n, $n == 1 ? "" : "s";
http://www.unix.org.ua/orelly/perl/prog3/ch03_16.htm
Thursday, October 13, 2005
NIS commands
$ nisgrep username passwd.org_dir
username:ENCRYPTPASSWD:1000305537:10:User Name:/home/username:/bin/ksh:13063:1:63:14:::
$ getent passwd username
username:x:1000305537:10:User Name:/home/username:/bin/ksh
$ niscat -o '[name=username]passwd.org_dir'
Object Name : "passwd"
Directory : "org_dir.domain.com."
Owner : "username.domain.com."
Group : ""
Access Rights : ----r-----------
Time to Live : 12:0:0
Creation Time : Wed Aug 3 13:10:33 2005
Mod. Time : Fri Oct 7 10:39:27 2005
Object Type : ENTRY
Entry data of type passwd_tbl
[0] - [8 bytes] 'username'
[1] - [14 bytes] Encrypted data
[2] - [11 bytes] 'XXXXXXXXX'
[3] - [3 bytes] '10'
[4] - [14 bytes] 'User Name'
[5] - [14 bytes] '/home/username'
[6] - [9 bytes] '/bin/ksh'
[7] - [17 bytes] Encrypted data
$ ypmatch USER passwd
autovivification
exists => nasty...
if ( $HASH{'key1'}{'key2'} );
Will define $HASH{'key1'}
If you don't want to do that you need to do:
if ( $HASH{'key1'} && $HASH{'key1'}{'key2'} );
if ( $HASH{'key1'}{'key2'} );
Will define $HASH{'key1'}
If you don't want to do that you need to do:
if ( $HASH{'key1'} && $HASH{'key1'}{'key2'} );
Subscribe to:
Posts (Atom)