#!/bin/bash if [ "$1" ] ; then DIR="$1" ; else DIR="$PWD" ; fi SCRIPT="permrestore${DIR//\//_}$( date +_%d_%m_%Y )"; permrestore "$DIR" | tee "$SCRIPT" chmod a+x "$SCRIPT"