Hi everyone!! I am NOT Topher Grace, nor do I want to be. I am just Topher Scribbles and just for kicks, I really want to out-rank Topher Grace's IMDB website. If you want to help, just link to me. Thanks and enjoy some boring fun!!

Bash Test Operators

Here’s a list I have compiled that explains many Bash test operators. This is pretty much all I use. I think there’s more, but I will add to it as I discover them. I’ve been wanting to put this online so I can use as a reference and I finally did. So here it is, enjoy!!

FILES/DIRECTORIES
-e file exists
-f file is a regular file (not a directory or device file)
-s (lowercase ’s’) file is not zero size
-S file is a socket
-d file is a directory
-b file is a block device (floppy, cdrom, etc.)
-c file is a character device (keyboard, modem, sound card, etc.)
-p file is a pipe
-h file is a symbolic link
-L file is a symbolic link
-t file (descriptor) is associated with a terminal device
-r file has read permission (for the user running the test)
-w file has write permission (for the user running the test)
-x file has execute permission (for the user running the test)
-g set-group-id (sgid) flag set on file or directory
-u set-user-id (suid) flag set on file
-k sticky bit set
-O you are owner of file
-G group-id of file same as yours
-N file modified since it was last read
f1 -nt f2 file f1 is newer than f2
f1 -ot f2 file f1 is older than f2
f1 -ef f2 files f1 and f2 are hard links to the same file
 
INTEGERS
-eq is equal to
-ne is not equal to
-gt is greater than
-ge is greater than or equal to
-lt is less than
-le is less than or equal to
< is less than (within double parentheses)
<= is less than or equal to (within double parentheses)
> is greater than (within double parentheses)
>= is greater than or equal to (within double parentheses)
 
STRINGS
= is equal to
== is equal to
 
The == comparison operator behaves differently within a double-brackets test than within single brackets.
[[ $a == z* ]] True if $a starts with an “z” (pattern matching).
[[ $a == “z*” ]] True if $a is equal to z* (literal matching).
 
[ $a == z* ] File globbing and word splitting take place.
[ “$a” == “z*” ] True if $a is equal to z* (literal matching).
 
!= is not equal to
< is less than, in ASCII alphabetical order
> is greater than, in ASCII alphabetical order
-n string is not “null.”
-z string is “null, ” that is, has zero length

Done!!

FreeBSD 6.2 + PHP5 + PHP5-extensions = php.core dumps!!

I had just recently installed 2 new servers and both of them had PHP dumps (php.core) and issued a segmented fault, signal 11. I installed PHP5 and installed PHP5-Extensions through the ports.

My first experience with the dump, I wrote a simple code to calculate interest rates, which was totally incorrect (my code btw). My second experience, on another server, was when I was installing pear-DB through the ports. It uses PHP to compile and it kept erroring and wouldn’t finish compiling. So I searched Google and found out that when you install PHP extensions via ports, these dumps occur. I am not sure about the exact reason why it dumps, but apparently PHP is very picky as to when the extensions are loaded, or rather the order in which they are loaded.

So my first search landed me to the FreeBSD lists, and there, they said to make sure the sessions module loaded first, or somewhat first. I edited my extensions.ini file (/usr/local/etc/php/extensions.ini) and moved ‘extension=session.so’ to the top of the list. I saved the file, and re-compiled pear-DB, and it still errored. So I researched some more and I was lead to pingle.org. His post mentioned the same extensions order as well, but placing some of the extensions last. He had recode, mysql, imap, sockets, and lastly pspell at the bottom of his list. I did the same and what do you know, no more dumps!! Woo Hoo.

From what people are saying is that when you have this “magic” order of extensions, to save the order because when you upgrade php or the extensions, it will overwrite this file.

Done!!