Find the answer to your Linux question:
Results 1 to 2 of 2
Consider the following shell script. Explain what lines 4, 6,7 and 9 do . What does the script output on the screen? #!/bin/sh MyVar=”.Blue/Green/Red/Yellow.” echo ${MyVar#*Green} val=${MyVar%%/*} echo $val MyVar=${MyVar#$val/} ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2008
    Posts
    2

    shells scripts


    Consider the following shell script. Explain what lines 4, 6,7 and 9 do . What does the script output on the screen?
    #!/bin/sh
    MyVar=”.Blue/Green/Red/Yellow.”
    echo ${MyVar#*Green}
    val=${MyVar%%/*}
    echo $val
    MyVar=${MyVar#$val/}
    val=${MyVar%%/*}
    echo $val
    MyVar=${MyVar#$val/}
    val=${MyVar%%/*}
    echo $val
    MyVar=${MyVar#$val/}
    val=${MyVar%%/*}
    echo $val

  2. #2
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    Welcome to the forums!

    Sorry, but this looks like homework and it's against the forums rules to post those kind of questions:

    http://www.linuxforums.org/forum/lin...ums-rules.html
    oz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •