Skip to content

Instantly share code, notes, and snippets.

@theoperatore
Created January 30, 2013 23:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save theoperatore/4678335 to your computer and use it in GitHub Desktop.
Save theoperatore/4678335 to your computer and use it in GitHub Desktop.
iterations for even/odd selection
i=0; FILES=$(ls -tr ./); for FILE in $FILES; do i=$(($i + 1)); if [$(($i % 2)) = 0]; then echo"$i$FILE"; fi; done;
outputs:
==>
-bash: [0: command not found
-bash: [1: command not found
-bash: [0: command not found
...
...
...
<==
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment