Created
March 29, 2017 11:27
-
-
Save leotm/87391bee805deca353b2b9109344c91f to your computer and use it in GitHub Desktop.
A shell script that creates an associate array and generates prefixed php files that redirect to the matching URLs
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
# How to iterate over associate arrays in Bash | |
# To generate PHP redirection files with prefixes | |
declare -A array | |
array["uk"]="https://www.google.co.uk" | |
array["fi"]="https://www.google.fi" | |
array["es"]="https://www.google.es" | |
for i in "${!array[@]}" | |
do | |
echo "<?php header('Location: ${array[$i]}'); ?>" > prefix-$i.php | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment