Monday, June 30, 2008

Bash shell scripting "IF THEN" logic

UBUNTU LINUX bash shell script file. Usage of the DU and LS commands. This file is an example of scripting logic "IF THEN" & script command arguments.
project:pitch-forks filename: Script
-------------------------------------

#!/bin/bash
if [[ $1 = "" ]]; then
echo "Usage: $0 size listing"
echo "Ubuntu Linux bash script by Johnny Buckallew Stroud 2008,"
echo "open public information. "
exit
fi

if [[ $2 = "size" ]]; then
du -h $1
exit
fi

if [[ $2 = "listing" ]]; then
ls -l $1
exit
fi

ls -l $1
du -h $1