#!/bin/bash CMD="split -d -a 4" _help() { split --help echo "" echo "My default switches for split utility" echo "$CMD -b 500M FILE FILE." } _helpexit() { _help exit } for (( i=1; i<=$#; i++ )); do [[ ${!i} = "-h" ]] && _helpexit [[ ${!i} = "--help" ]] && _helpexit done args=( ) for (( i=1; i<=$#; i++ )); do test -f "${!i}" && { file="${!i}" # file found, remove from arguments set -- "${@:1:i-1}" "${@:i+1}" } [[ "${!i}" = "-b" ]] && SIZE_SET=1 done [[ "$SIZE_SET" -eq 1 ]] || { size="-b 500M" } test -f "$file" || { echo "No such file"; exit 1; } set -x pv "$file" | $CMD $size "$@" - "$file".