Linux

Hints and Tips for general shell script programming

WARNING: this will fail if the user is playing with $0 For example using a symbolic or hard link with a unexpected name. # Simplest… # PROGNAME=`type $0 | awk ‘{print $3}’` # search for executable on path PROGNAME=`basename $PROGNAME` # base name of program # Advanced… # Script name, in what directory, and in […]

Read More
Security

Shell script for search for no password entries and lock all accounts

Shell script for search for no password entries and lock all accounts find-account-no-password.sh #!/bin/bash # Shell script for search for no password entries and lock all accounts # ————————————————————————- # Copyright (c) 2005 nixCraft project # This script is licensed under GNU GPL version 2.0 or above # ————————————————————————- # This script is part of […]

Read More
Linux

Bash shell script to reverse text file content

Shell script to reverse text file contain i.e. concatenate files and print on the standard output in reverse. This script also demonstrate how to use arrays under bash shell script. reverse-text-file.bash #!/bin/bash # Bash shell script to reverse text file contain i.e. concatenate files and # print on the standard output in reverse. This script […]

Read More
Security

Detecting changes to your network services/damons

This is a tutorial to detect changes in port from hosts on your network. The basic approach is to ping every available address upon your subnet and see which ones are up by detecting replies. If you install the package libperl-net-ping you can use the following script to see which hosts upon your LAN are […]

Read More