I'm doing a restore backups script, and when I try to join files which are splitted, cat prints that error:cat: fullbackup_mrbsNuevo_15_6_2016.tar.gz.*: No such file or directoryThe line that runs cat command is this one:cat $type_$NAME_DIR_$d_$2_$1.tar.gz.\* > $type_$NAME_DIR_$d_$2_$1.tar.gzI have checked if the files exist and they are in the directory. Also I have tried running the command in the shell and works fine.I don't know what is bad in my script.When I run the ls command in the directory the files are:cisco@Paquito1:/tmp/backup$ ls -lahtotal 7,1Mdrwxr-xr-x 2 cisco cisco 4,0K 2016-06-18 12:01 .drwxrwxrwt 5 root  root  4,0K 2016-06-18 10:10 ..-rw-r--r-- 1 cisco cisco 5,0M 2016-06-18 11:52 fullbackup_mrbsNuevo_15_6_2016.tar.gz.aa-rw-r--r-- 1 cisco cisco 2,1M 2016-06-18 11:52 fullbackup_mrbsNuevo_15_6_2016.tar.gz.abAnd before executing the cat command I move to the /tmp/backup directory.Thanks in advance.
cat doesn't join my files when I run inside script
shell;ubuntu;scripting
you shouldn't escape *, this will result in shell/bash searching for a litteral star, not expanding filename.trycat $type_$NAME_DIR_$d_$2_$1.tar.gz.* > $type_$NAME_DIR_$d_$2_$1.tar.gzediton a side note I would quotecat ${type}_${NAME_DIR}_${d}_${2}_${1}.tar.gz.* > ${type}_${NAME_DIR}_${d}_${2}_${1}.tar.gz