Reputation: 47
How can I write an equivalent GNU/Linux command which gives the same output as the script? The input to the command should be the same as the variable var1 in the following script.
#!/bin/python
my_char = { 'a':'b', 'b':'c', 'c':'d'}
var1 = "abc"
var2 = ""
for ch in var1:
if ch in my_char:
var2+=my_char[ch]
else:
var2+=ch
print var2
Upvotes: 0
Views: 50