0

I am writing a shell script to find difference within the artifact on the basis of difference of timestamp on Jfrog

#!/bin/bash

echo "Validating jfrog configs"
jfrog c show
echo "*************************************************"

echo "Getting current date and time"
currentDateTime=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "Value of current date and time: $currentDateTime"
echo "*************************************************"

echo "Getting two hr previous time"
previousTime=$(date -u -v -2H +"%Y-%m-%dT%H:%M:%SZ")
echo "Two hour previous time: $previousTime"
echo "*************************************************"

echo "Putting Current url in url variable "
url="https://<url>/"
echo "Url: $url"
echo "*************************************************"

echo "Putting Repo value in repo"
repo="<repo>"
echo "Repo value: $repo"
echo "*************************************************"


echo "Query JFrog for artifacts modified after the specified date and time"
echo "jfrog rt s --spec='{\"files\": [{\"pattern\": \"$repo/*\", \"modified\": {\"from\": \"$previousTime\", \"to\": \"$currentDateTime\"}}]}' --url=\"$url\""
changedArtifacts=$(jfrog rt s --spec='{"files": [{"pattern": "'"$repo"'/*", "modified": {"from": "'"$previousTime"'", "to": "'"$currentDateTime"'"}}]}' --url="$url")
echo "Changed artifact value: $changedArtifacts"
echo "*************************************************"

Here in url and repo - I have put my required repo and url(artifactory url), but on executing the script, I am getting error

: no such file or directory

Have tried updating url path till artifactory, have also tried passing complete url and passing base url only.

but everytime getting the same error

: no such file or directory

  • On which command do you actually get this error? Did you try to debug this with $ bash -x ./script.sh command? – shaibz Jun 29 '23 at 15:28

0 Answers0