Skip to content

Commit

Permalink
Simplification of codes suggested by @actionless
Browse files Browse the repository at this point in the history
  • Loading branch information
gusbemacbe committed Feb 22, 2019
1 parent 9198696 commit ac8b466
Show file tree
Hide file tree
Showing 9 changed files with 180 additions and 171 deletions.
39 changes: 20 additions & 19 deletions 60spsycho.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#!/usr/bin/env bash

if grep --quiet 'url(#arrongin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#arrongin)/url(#60spsycho)/g'
elif grep --quiet 'url(#aurora)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#aurora)/url(#60spsycho)/g'
elif grep --quiet 'url(#fitdance)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#fitdance)/url(#60spsycho)/g'
elif grep --quiet 'url(#oomox)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#oomox)/url(#60spsycho)/g'
elif grep --quiet 'url(#rainblue)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#rainblue)/url(#60spsycho)/g'
elif grep --quiet 'url(#sunrise)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#sunrise)/url(#60spsycho)/g'
elif grep --quiet 'url(#telinkrin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#telinkrin)/url(#60spsycho)/g'
elif grep --quiet 'url(#90ssummer)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#90ssummer)/url(#60spsycho)/g'
else
sed --in-place --follow-symlinks *.svg -e 's/currentColor/url(#60spsycho)/g'
fi
NEW_COLOR="url(#60spsycho)"

ALL_COLORS=(
"url(#arrongin)"
"url(#aurora)"
"url(#fitdance)"
"url(#oomox)"
"url(#rainblue)"
"url(#sunrise)"
"url(#telinkrin)"
"url(#90ssummer)"
"currentColor"
)

for color in "${ALL_COLORS[@]}" ; do
if grep --quiet "$color" *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/'"$color"'/'"$NEW_COLOR"'/g'
break
fi
done
39 changes: 20 additions & 19 deletions 90ssummer.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#!/usr/bin/env bash

if grep --quiet 'url(#arrongin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#arrongin)/url(#90ssummer)/g'
elif grep --quiet 'url(#aurora)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#aurora)/url(#90ssummer)/g'
elif grep --quiet 'url(#fitdance)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#fitdance)/url(#90ssummer)/g'
elif grep --quiet 'url(#oomox)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#oomox)/url(#90ssummer)/g'
elif grep --quiet 'url(#rainblue)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#rainblue)/url(#90ssummer)/g'
elif grep --quiet 'url(#sunrise)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#sunrise)/url(#90ssummer)/g'
elif grep --quiet 'url(#telinkrin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#telinkrin)/url(#90ssummer)/g'
elif grep --quiet 'url(#60spsycho)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#60spsycho)/url(#90ssummer)/g'
else
sed --in-place --follow-symlinks *.svg -e 's/currentColor/url(#90ssummer)/g'
fi
NEW_COLOR="url(#90ssummer)"

ALL_COLORS=(
"url(#arrongin)"
"url(#aurora)"
"url(#fitdance)"
"url(#oomox)"
"url(#rainblue)"
"url(#sunrise)"
"url(#telinkrin)"
"url(#60spsycho)"
"currentColor"
)

for color in "${ALL_COLORS[@]}" ; do
if grep --quiet "$color" *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/'"$color"'/'"$NEW_COLOR"'/g'
break
fi
done
39 changes: 20 additions & 19 deletions arrongin.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#!/usr/bin/env bash

if grep --quiet 'url(#aurora)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#aurora)/url(#arrongin)/g'
elif grep --quiet 'url(#fitdance)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#fitdance)/url(#arrongin)/g'
elif grep --quiet 'url(#oomox)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#oomox)/url(#arrongin)/g'
elif grep --quiet 'url(#rainblue)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#rainblue)/url(#arrongin)/g'
elif grep --quiet 'url(#sunrise)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#sunrise)/url(#arrongin)/g'
elif grep --quiet 'url(#telinkrin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#telinkrin)/url(#arrongin)/g'
elif grep --quiet 'url(#60spsycho)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#60spsycho)/url(#arrongin)/g'
elif grep --quiet 'url(#90ssummer)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#90ssummer)/url(#arrongin)/g'
else
sed --in-place --follow-symlinks *.svg -e 's/currentColor/url(#arrongin)/g'
fi
NEW_COLOR="url(#arrongin)"

ALL_COLORS=(
"url(#aurora)"
"url(#fitdance)"
"url(#oomox)"
"url(#rainblue)"
"url(#sunrise)"
"url(#telinkrin)"
"url(#60spsycho)"
"url(#90ssummer)"
"currentColor"
)

for color in "${ALL_COLORS[@]}" ; do
if grep --quiet "$color" *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/'"$color"'/'"$NEW_COLOR"'/g'
break
fi
done
39 changes: 20 additions & 19 deletions aurora.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#!/usr/bin/env bash

if grep --quiet 'url(#arrongin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#arrongin)/url(#aurora)/g'
elif grep --quiet 'url(#fitdance)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#fitdance)/url(#aurora)/g'
elif grep --quiet 'url(#oomox)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#oomox)/url(#aurora)/g'
elif grep --quiet 'url(#rainblue)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#rainblue)/url(#aurora)/g'
elif grep --quiet 'url(#sunrise)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#sunrise)/url(#aurora)/g'
elif grep --quiet 'url(#telinkrin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#telinkrin)/url(#aurora)/g'
elif grep --quiet 'url(#60spsycho)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#60spsycho)/url(#aurora)/g'
elif grep --quiet 'url(#90ssummer)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#90ssummer)/url(#aurora)/g'
else
sed --in-place --follow-symlinks *.svg -e 's/currentColor/url(#aurora)/g'
fi
NEW_COLOR="url(#aurora)"

ALL_COLORS=(
"url(#arrongin)"
"url(#fitdance)"
"url(#oomox)"
"url(#rainblue)"
"url(#sunrise)"
"url(#telinkrin)"
"url(#60spsycho)"
"url(#90ssummer)"
"currentColor"
)

for color in "${ALL_COLORS[@]}" ; do
if grep --quiet "$color" *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/'"$color"'/'"$NEW_COLOR"'/g'
break
fi
done
39 changes: 20 additions & 19 deletions fitdance.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#!/usr/bin/env bash

if grep --quiet 'url(#arrongin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#arrongin)/url(#fitdance)/g'
elif grep --quiet 'url(#aurora)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#aurora)/url(#fitdance)/g'
elif grep --quiet 'url(#oomox)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#oomox)/url(#fitdance)/g'
elif grep --quiet 'url(#rainblue)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#rainblue)/url(#fitdance)/g'
elif grep --quiet 'url(#sunrise)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#sunrise)/url(#fitdance)/g'
elif grep --quiet 'url(#telinkrin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#telinkrin)/url(#fitdance)/g'
elif grep --quiet 'url(#60spsycho)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#60spsycho)/url(#fitdance)/g'
elif grep --quiet 'url(#90ssummer)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#90ssummer)/url(#fitdance)/g'
else
sed --in-place --follow-symlinks *.svg -e 's/currentColor/url(#fitdance)/g'
fi
NEW_COLOR="url(#fitdance)"

ALL_COLORS=(
"url(#arrongin)"
"url(#aurora)"
"url(#oomox)"
"url(#rainblue)"
"url(#sunrise)"
"url(#telinkrin)"
"url(#60spsycho)"
"url(#90ssummer)"
"currentColor"
)

for color in "${ALL_COLORS[@]}" ; do
if grep --quiet "$color" *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/'"$color"'/'"$NEW_COLOR"'/g'
break
fi
done
39 changes: 20 additions & 19 deletions oomox.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#!/usr/bin/env bash

if grep --quiet 'url(#arrongin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#arrongin)/url(#oomox)/g'
elif grep --quiet 'url(#aurora)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#aurora)/url(#oomox)/g'
elif grep --quiet 'url(#fitdance)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#fitdance)/url(#oomox)/g'
elif grep --quiet 'url(#rainblue)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#rainblue)/url(#oomox)/g'
elif grep --quiet 'url(#sunrise)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#sunrise)/url(#oomox)/g'
elif grep --quiet 'url(#telinkrin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#telinkrin)/url(#oomox)/g'
elif grep --quiet 'url(#60spsycho)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#60spsycho)/url(#oomox)/g'
elif grep --quiet 'url(#90ssummer)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#90ssummer)/url(#oomox)/g'
else
sed --in-place --follow-symlinks *.svg -e 's/currentColor/url(#oomox)/g'
fi
NEW_COLOR="url(#oomox)"

ALL_COLORS=(
"url(#arrongin)"
"url(#aurora)"
"url(#fitdance)"
"url(#rainblue)"
"url(#sunrise)"
"url(#telinkrin)"
"url(#60spsycho)"
"url(#90ssummer)"
"currentColor"
)

for color in "${ALL_COLORS[@]}" ; do
if grep --quiet "$color" *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/'"$color"'/'"$NEW_COLOR"'/g'
break
fi
done
39 changes: 20 additions & 19 deletions rainblue.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#!/usr/bin/env bash

if grep --quiet 'url(#arrongin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#arrongin)/url(#rainblue)/g'
elif grep --quiet 'url(#aurora)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#aurora)/url(#rainblue)/g'
elif grep --quiet 'url(#fitdance)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#fitdance)/url(#rainblue)/g'
elif grep --quiet 'url(#oomox)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#oomox)/url(#rainblue)/g'
elif grep --quiet 'url(#sunrise)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#sunrise)/url(#rainblue)/g'
elif grep --quiet 'url(#telinkrin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#telinkrin)/url(#rainblue)/g'
elif grep --quiet 'url(#60spsycho)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#60spsycho)/url(#rainblue)/g'
elif grep --quiet 'url(#90ssummer)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#90ssummer)/url(#rainblue)/g'
else
sed --in-place --follow-symlinks *.svg -e 's/currentColor/url(#rainblue)/g'
fi
NEW_COLOR="url(#rainblue)"

ALL_COLORS=(
"url(#arrongin)"
"url(#aurora)"
"url(#fitdance)"
"url(#oomox)"
"url(#sunrise)"
"url(#telinkrin)"
"url(#60spsycho)"
"url(#90ssummer)"
"currentColor"
)

for color in "${ALL_COLORS[@]}" ; do
if grep --quiet "$color" *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/'"$color"'/'"$NEW_COLOR"'/g'
break
fi
done
39 changes: 20 additions & 19 deletions sunrise.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#!/usr/bin/env bash

if grep --quiet 'url(#arrongin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#arrongin)/url(#sunrise)/g'
elif grep --quiet 'url(#aurora)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#aurora)/url(#sunrise)/g'
elif grep --quiet 'url(#fitdance)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#fitdance)/url(#sunrise)/g'
elif grep --quiet 'url(#oomox)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#oomox)/url(#sunrise)/g'
elif grep --quiet 'url(#rainblue)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#rainblue)/url(#sunrise)/g'
elif grep --quiet 'url(#telinkrin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#telinkrin)/url(#sunrise)/g'
elif grep --quiet 'url(#60spsycho)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#60spsycho)/url(#sunrise)/g'
elif grep --quiet 'url(#90ssummer)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#90ssummer)/url(#sunrise)/g'
else
sed --in-place --follow-symlinks *.svg -e 's/currentColor/url(#sunrise)/g'
fi
NEW_COLOR="url(#sunrise)"

ALL_COLORS=(
"url(#arrongin)"
"url(#aurora)"
"url(#fitdance)"
"url(#oomox)"
"url(#rainblue)"
"url(#telinkrin)"
"url(#60spsycho)"
"url(#90ssummer)"
"currentColor"
)

for color in "${ALL_COLORS[@]}" ; do
if grep --quiet "$color" *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/'"$color"'/'"$NEW_COLOR"'/g'
break
fi
done
39 changes: 20 additions & 19 deletions telinkrin.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#!/usr/bin/env bash

if grep --quiet 'url(#arrongin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#arrongin)/url(#telinkrin)/g'
elif grep --quiet 'url(#aurora)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#aurora)/url(#telinkrin)/g'
elif grep --quiet 'url(#fitdance)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#fitdance)/url(#telinkrin)/g'
elif grep --quiet 'url(#oomox)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#oomox)/url(#telinkrin)/g'
elif grep --quiet 'url(#rainblue)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#rainblue)/url(#telinkrin)/g'
elif grep --quiet 'url(#sunrise)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#sunrise)/url(#telinkrin)/g'
elif grep --quiet 'url(#60spsycho)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#60spsycho)/url(#telinkrin)/g'
elif grep --quiet 'url(#90ssummer)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#90ssummer)/url(#telinkrin)/g'
else
sed --in-place --follow-symlinks *.svg -e 's/currentColor/url(#telinkrin)/g'
fi
NEW_COLOR="url(#telinkrin)"

ALL_COLORS=(
"url(#arrongin)"
"url(#aurora)"
"url(#fitdance)"
"url(#oomox)"
"url(#rainblue)"
"url(#sunrise)"
"url(#60spsycho)"
"url(#90ssummer)"
"currentColor"
)

for color in "${ALL_COLORS[@]}" ; do
if grep --quiet "$color" *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/'"$color"'/'"$NEW_COLOR"'/g'
break
fi
done

0 comments on commit ac8b466

Please sign in to comment.