#!/bin/sh # This simply makes a backup of a file as filename.bak if [[ -n "$1" ]]; then cp "$1"{,.bak} fi if [ $# -ge 1 ]; then for f in $@ do [ -f "$f" ] &&cp "$f"{,.bak} done else echo "No filenames passed." exit 1 fi