#!/bin/bash # fai = "For A In * ; do $a ; done # as normally my loops are no more complicated than that. # Usage: fai arg1 arg2 arg3 ...argN command # Effect: command arg1 # command arg2 # command arg3 # ... # command argN for a in `seq 1 $(($#-1))` do ${!#} ${!a} done # for zsh put this in your .zshrc so that other functions and aliases and things # still work: # function fai () { for a in `seq 1 $(($# - 1))`; do ${*[$#]} ${*[${a}]} ; done } # bash function is just as above: # function blah () { for a in `seq 1 $(($#-1))` ; do ${!#} ${!a} ; done; }