Created
May 21, 2015 10:56
-
-
Save antoni/6755fc1be9dcd36a5995 to your computer and use it in GitHub Desktop.
Various bash scripts
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
# (1) mv with regexp | |
for i in *; do mv -n "$i" "${i/_*dpi*}".png; done; | |
# (2) Loop over array of strings | |
declare -a arr=("element1" "element2" "element3") | |
## now loop through the above array | |
for i in "${arr[@]}" | |
do | |
echo "$i" | |
# or do whatever with individual element of the array | |
done | |
# Access them using echo "${arr[0]}", "${arr[1]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment