Skip to content

Instantly share code, notes, and snippets.

@tuttelikz
Created January 20, 2018 04:50
Show Gist options
  • Save tuttelikz/b040f13ca147c6a4f84f3231f4a49ad5 to your computer and use it in GitHub Desktop.
Save tuttelikz/b040f13ca147c6a4f84f3231f4a49ad5 to your computer and use it in GitHub Desktop.
For running multiple bash commands
#This is an example how to run multiple bash commands together
# Just put && symbol between commands
cd o_cheek/ && num=0; for i in *; do mv "$i" "$(printf 'cheek_old_%04d' $num).${i#*.}"; ((num++)); done && cd .. && mv o_cheek cheek_old && cd o_eye/ && num=0; for i in *; do mv "$i" "$(printf 'eye_old_%04d' $num).${i#*.}"; ((num++)); done && cd .. && mv o_eye eye_old && cd o_forearm/ && num=0; for i in *; do mv "$i" "$(printf 'forearm_old_%04d' $num).${i#*.}"; ((num++)); done && cd .. && mv o_forearm forearm_old && cd y_cheek/ && num=0; for i in *; do mv "$i" "$(printf 'cheek_young_%04d' $num).${i#*.}"; ((num++)); done && cd .. && mv y_cheek cheek_young && cd y_eye/ && num=0; for i in *; do mv "$i" "$(printf 'eye_young_%04d' $num).${i#*.}"; ((num++)); done && cd .. && mv y_eye eye_young && cd y_forearm/ && num=0; for i in *; do mv "$i" "$(printf 'forearm_young_%04d' $num).${i#*.}"; ((num++)); done && cd .. && mv y_forearm forearm_young
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment