Last active
January 24, 2023 10:04
-
-
Save vishnukumarpv/3e8ac7a3483611cd26eb508e48ec24a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Declare an array to store the URLs | |
urls=() | |
# Read the URLs from the text file | |
while IFS= read -r line; do | |
urls+=($line) | |
done < "list.txt" | |
# Loop through the array of URLs | |
for url in "${urls[@]}" | |
do | |
# Make a GET request to each URL and store the response code | |
response_code=$(curl -s -o /dev/null -w "%{http_code}" $url) | |
# Check if the response code is not 200 (OK) | |
if [ $response_code -ne 200 ] | |
then | |
echo "Error: $url returned a $response_code response code" | |
else | |
echo "$url is up and running" | |
fi | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create a list of all .yml files in the current directory | |
files=$(ls -1 *.yml) | |
# Iterate through the list of files | |
for file in $files; do | |
# Use grep to extract the line containing "uuid" | |
# Use awk to extract the value of "uuid" | |
uuid=$(grep "uuid" $file | awk '{print $2}') | |
echo "$file: $uuid" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#!/bin/bash
Create a list of all .yml files in the current directory
files=$(ls -1 *.yml)
Iterate through the list of files
for file in $files; do
# Use grep to extract the line containing "uuid"
# Use awk to extract the value of "uuid"
uuid=$(grep "uuid" $file | awk '{print $2}')
echo "$file: $uuid"
done