Questions

1:Which of the following are valid variable names?
  1. _FRUIT_BASKET

  2. 1_APPLE_A_DAY

  3. FOUR-SCORE&7YEARS_AGO

  4. Variable

2:Is the following sequence of array assignments valid in sh, ksh, and bash?
$ adams[0]=hitchhikers_guide
$ adams[1]=restaurant
$ adams[3]=thanks_for_all_the_fish
$ adams[42]=life_universe_everything
$ adams[5]=mostly_harmless
3:Given the preceding array assignments, how would you access the array item at index 5 in the array adams? How would you access every item in the array?
4:What is the difference between an environment variable and a local variable?

Get Sams Teach Yourself Shell Programming in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.