Print all combination of 1 2 3 coderinme

Check detect file has renamed and PID

Check detect file has renamed and PID
Let us now code something based on numbers. Such as, We can create a kind of puzzle by jumbling some of the digits. In other words we can mix and match different digits to create different numbers in the number system.
For example : We are now going to print print all the possible combinations using the three digits – 1, 2, and 3. It is just like the numbers obtained could be 123, 231, 213, 231,132,312, 321.

#!/bin/bash
for((i=1;i<=3; i++)); do
echo -n "$i"
for((j=1; j<=3; j++)); do
if [ $j -ne $i ]; then
echo -n "$j"
fi
done
echo""
echo -n "$i"
for((k=3; k>=1; k--)); do
if [ $k -ne $i ]; then
echo -n "$k"
fi
done
echo ""
done

For more programs in shell, visit our Shell Coder Archives

print all combination

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without prior written permission of website admin, except in case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

A web developer(Front end and Back end), and DBA at csdamu.com. Currently working as Salesforce Developer @ Tech Matrix IT Consulting Private Limited. Check me @about.me/s.saifi

Leave a reply:

Your email address will not be published.