I am trying to create a quick script that will get a file from a backup folder. The backup file is generated every day and have the filename format of:
backup-sql-YYYYMMDD.zip
I am trying to get the filename by using:
#!/bin/sh VAR_1="backup-sql-" VAR_2=date +%Y%m%d VAR_3=$VAR_1$VAR_2 echo "$VAR_3" However the output is:
backup-sql-
When I run:
date +%Y%m%d I get
20180704 So I am not sure why this is happening. Please can someone help me :)
VAR_2=date +%Y%m%d(assuming you'd have acted on it or at the very least told us about it if you were getting a syntax error).$()