swaping
Hello!
it is linux bash shell script language. i have a variable var=abcdef now i want to replace the a with z, b with y, c with x. how can i do this. that the new values of variable will be var=zyxwvu |
Ahhh.... What programming language? Does it matter?
You directly stated your problem, but did not define a configuration set for the problem to be on top of. |
That depends at least partially on:
a) what language you're using b) what data type the variable is |
Did you really read the post?
The OP said "bash shell script". |
so, what you've done so far? any code to show? we're not going to write it for you
|
Quote:
|
Quote:
|
The desired result seems to be poorly stated. According to this:
"replace the a with z, b with y, c with x" the end result should be: $var = zyxdef This is simply the reverse of the original: var=fedcba |
Maybe he meant that is the string were the alphabet, a would become z, etc. I agree that it's a impossible to understand and dumb way of saying "reverse a string", but maybe.
|
If that is the case, then:
var=abcdef var=$(echo $var|rev) |
All times are GMT -5. The time now is 04:36 PM. |