Table of Contents

Advanced bash scripting

http://www.tldp.org/LDP/abs/html/index.html

Bash Commands

Finding a size of a file

file_size=$(stat -c%s "$FILENAME")

Wait for user to strike a key

read -p "Press [Enter] key to start backup..."

Filename from Filepath

Extracting File Name with extension and without extension given full file path

filewithpath=/home/name/path/subpath/etc/abc.txt
filename=$(basename $filewithpath)
filenoext=${filename%%.*}

filename will have abc.txt

filenoext will have abc