Q:

How to make permutation in bash with N!  input? 

I have to make a permutation in bash with "eval" and "seq" commands.  So I have to make first a permutation that could contain the same numbers, then I have to filter it somehow. 
The teacher told me I have to use two cycle/period, one in the other.  But I don't know how to do it. 
The input is like:
3

The output should be:
123
132
213
231
312
321

If someone could help me, that would be great! 
Edit:
I want to know how to do it with these commands, my friend made it to me like this: http://pastebin.com/wM2U1SuT
the teacher told me its too good, were not on this level.. i should do it with seq and eval, even if its not that good then.  The second problem was that the input was 123, not 3, like 3!..  

A:

If someones curious, heres the solution:  
input=3
for i in $(eval echo " {1..$input}{1..$input}{1..$input} "); do
    OK=yes
    for pos1 in $(seq 0 $((x,1)) ); do
        for pos2 in $(seq 0 $((x,1)) ); do
            if [ $pos1 ! = $pos2 ]; then
                if [ ${i:$pos1:1} == ${i:$pos2:1} ]; then
                    OK=no
                fi
            fi
        done
    done
    if [ $OK = yes ]; then
        echo $i
    fi

done

