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.
- 05-20-2008 #1Just 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
- 05-20-2008 #2forum.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.htmloz



