Thursday, July 14, 2016

Shell Script Basic Code Examples(5)

Smiley face

Code:Array

Smiley face

Output:

Smiley face

Note

you can define array one by one orelse all are one step

to print array value ${arr[0]},${arr[1]},...

to print all elements of array use "@" or "*"

ex: ${arr[@]}  
  : ${arr[*]} 

Code:Shell Variables

Smiley face

Output:

Smiley face

Note

why ";" used 4th line before "cal"

with out ";" "cal" take as a string so print "cal"

with ";" only "cal" take as shell variable so print the calender

also you can do it without ";" by adding cal to the next line

Smiley face

No comments:

Post a Comment

Wel Come !!! computer express