Quote:
Originally Posted by grail
Code:
#!/bin/bash
(( ${#1} < 1 )) && exit || echo ${1:1:1}${1:0:1}$($0 ${1:2})
|
Amazing. I have one more squeezing round based on that:
Code:
#!/bin/bash
(( $1 )) && echo ${1:1:1}${1:0:1}$($0 ${1:2})
Ahahahahahah, man bash IS fun.
Actually we hit a pattern here, look how to use it to simulate "rev":
Code:
#!/bin/bash
last=$(( ${#1} - 1 ))
(( $1 )) && echo ${1:$last}$($0 ${1:0:$last})
Good thread btw. As to the issue with homework, hadn't actually given thought. Will try to have it into account in the future, though I wonder about "abandoned" threads when the OP disappears and a concrete answer didn't make it to any post...anyway I'm new here.