Here’s a script that will help you count the lines of input from the standard input: result=0 while read inputline do result=`expr $result + 1` done echo $result Now, you can find out the number of files in a directory using: ls -1 | count Update As Jeff Harver has kindly pointed out in the…
Tag: system management
Backup Your Linux Machine
I was up to maintenance of my Debian box, and I came in need of creating and maintaining multiple, date-based backups of the machine. Here is the bash script I wrote to accomplish this. #!/bin/bash #Shell Script to backup desired target verbose=”0″ tarv=”” if test “$1” == “-v”; then verbose=”1″ tarv=”-v” fi if test “$verbose”…
Having Your Shell Tweet
Have you ever wanted to have your *nix shell access Twitter? Using the RESTful API, you can achieve this. However, you would need to set up your instance as an app and then configure the API keys and all the what-nots. I personally try to avoid such hassle whenever possible. So, I got this shell…