#!/bin/bash . ${0%/*}/common diffopts= change= while [ $# -gt 0 ]; do case "$1" in -c) change="$2"; shift;; -d[blnsw]|-f|-t|-s[abdelr]) diffopts="$diffopts $1";; -dc) diffopts="$diffopts $1"; if [ -n "$2" -a -z "${2//[0-9]/}" ]; then diffopts="$diffopts $2" shift fi ;; -m) diffopts="$diffopts $1 $2" shift ;; *) break;; esac shift done if [ -z "$change" ]; then change="${1:-default}"; shift fi files=$(p4 $p4opts opened -c "$change" ${1+"$@"} | sed 's/#.*//') [ -n "$files" ] && p4 $p4opts diff $diffopts $files