#!/usr/bin/env bash JOBS_DIR=~/day_2/jobs # Get file path as first argument FILE_PATH="$1" # Get only the file name from the path FILE_NAME=$(basename "$FILE_PATH") # Get the date in wished format DATE=$(date -Iseconds) # Combine name of new file NEW_NAME="$DATE"_"$FILE_NAME" # Copy job file with new name cp "$FILE_PATH" "$JOBS_DIR"/"$NEW_NAME"