Last active
August 25, 2023 06:21
-
-
Save goooooouwa/b7b6c2edbec3520a9b0a to your computer and use it in GitHub Desktop.
daily bash script samples
This file contains 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 | |
# For loop to exeute some task multiple times | |
for i in Item1 Item2 ItemN; do | |
bash ~/task.sh ${i} | |
done | |
for i in {1..10} | |
do | |
wget https://static.generated.photos/vue-static/human-generator/poses/female/00$i.png | |
done | |
# use git conbined with sed/awk to automate text processing tasks | |
eval "find app/ -type f -exec sed -i 's/target/replacement/g' {} \;" | |
git diff | |
echo -n "Here be dragons. Continue?" | |
read REPLY | |
if [[ "$REPLY" =~ ^[Yy]$ ]] | |
then | |
git add . | |
git cm "processing $1 complete" | |
fi | |
# add namespace to all models | |
find app/models/ -type f -exec sed -i "1 i module MyModule" {} \; | |
find app/models/ -type f -exec sed -i "$ a end" {} \; | |
# you can also automate code indentation, see https://gist.github.com/goooooouwa/d5f40319ab7fb80a7fe4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment