开发者

Mirroring a string

How can I mirror a string? If found this: echo $("123" | rev). 开发者_如何学CThis works fine. But when I put it in a variable, it doesn't display anything:

output=$("123" | rev)
echo $output

How can I get this done?


Fixed that for you:

output $(echo -n "123" | rev)
echo $output

If its in a subshell, make sure output is not local, and export it explicitely:

function bla()
{
    output=$(echo -n "123" | rev)
    export output
}

bla    
echo $output

Next time, you might want to mention more relevant context in your question :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜