Listing 1. Shell Script for Use in Prompt

#!/bin/bash
# lsbytesum - sum the number of bytes in a # directory listing TotalBytes=0 # cut below could fail - sed would be a good # alternative? for Bytes in $(ls -l | grep "^-" | cut -c30-41) do let TotalBytes=$TotalBytes+$Bytes done TotalMeg=$(echo -e "scale=3 \n$TotalBytes/1048576\ \nquit" | bc) echo -n "$TotalMeg"