I am using
curl to download the file from a url. Currently I am able to download the file as it is in the current directory using the
curl command like
curl -O http://path/to/url/17.01.24/smcfs-17.01.24.ear
This downloads the file alright but saves it in the current directory by the name
smcfs-17.01.24.ear as expected. However I would like to download and save this file by creating a directory inside the current directory with bash script like
if [[ ! -d "$4" ]]; then mkdir "$4" curl -O http://path/to/url/$4/smcfs-$4.ear #I would like curl to fucntion like I said here fi
NOTE: In above code snippet I am taking the version number i.e
4rth argument of script
The expected output will be that curl download the file
smcfs-17.01.24.ear by the name
smcfs.ear in the directory
17.01.24 which is the subdirectory of the current diretory.
I would like to achieve this without going into the subdirectory, using curl to download and then coming back to the current directory.