Reverse parameters order


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  1. !/bin/sh
  2.  
  3. reverse_order()
  4. {
  5. for n in $@
  6. do
  7. reverse="$n $reverse";
  8. done
  9.  
  10. echo $reverse
  11. }
  12.  
  13. # example
  14. reversed=$(reverse_order $@)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.