Programming Tutorials and HowTos

Programming related tutorials, topics, howtos, tips, and hacks under Linux, OS X, *BSD and Unix like operating systems with special focus on sys admin/devops tasks ( rss feed ).

If var is defined AND NOT EMPTY, use var, otherwise set a default variable under Bash. For e.g. my script needs a parameter for output variable. It can be text or html. I set it as follows in my script

output=$1 # either text or html

However, sometime user forget to pass the parameter to my shell script and my enter logic fails. So how do I set default value to text, if no parameter passed?

{ 6 comments }

I own a small business website. However, bots started to abusing my forms such as contact.php. How do I stop bots bots from abusing my site? How do I tell if PHP form is submitted by a person or a script?

{ 25 comments }

How do I change user password using a shell script under FreeBSD operating systems?

{ 6 comments }

Can you explain usage of predefined variables called $_SERVER['PHP_SELF']?

{ 4 comments }

I‘ve installed a Web server (Apache2) and like to use Python interpreter correctly. How do I configure mod_python under Debian or Ubuntu Linux running Apache server version 2.x?

{ 11 comments }

How do I install GNU/GCC compiler and related tools (such as make, debugger, man pages) collection under Debian Linux system using command line options?

{ 16 comments }

How do I redirect output and errors to /dev/null under bash / sh shell scripting? How do I redirect the output of stderr to stdout, and then redirect this combined output to /dev/null?

{ 18 comments }