Error in the cp command in shell script

0

I have the following code written for a shell script

#!/bin/bash

if [ ! -f "$1" ]; then
   echo $1 "no existe"
else
   A=$(ls $1* | wc -w)
   if [ $A -ge 9 ]; then
       echo "Se ha superado el número máximo de versiones"
   else
       Num=$(date +%y/%m/%d)
       Version=$1.$Num
       cp $1 $Version
   fi
fi

When I execute it and pass it as a parameter a file gives me the following error cp: can not create regular file 'test.18 / 03/19': No such file or directory I would appreciate any help. I'm a bit of a neophyte on this issue and I'm losing my mind. Thanks in advance

    
asked by Alejandro Sánchez 19.03.2018 в 18:26
source

0 answers