How_To_Linux_Solutions/day_2/submitter.sh
2022-08-29 22:35:33 +02:00

18 lines
353 B
Bash
Executable file

#!/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"