Amod Pandey - My Workshop

There is a lot that human can do, for everything else there is [shell] script :)

Thursday, October 18, 2012

Shell script thingy

Did you know: Hypen, -, is not allowed in script variable names!

a="A"
b="B"

echo "$a_$b"

will print B??!!

it will treat $a_ as the first variable name.

To fix it

echo "${a}_${b}"
Posted by Amod at 7:03 PM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: shell script, shell script variable name

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2017 (1)
    • ►  January (1)
  • ►  2016 (5)
    • ►  December (3)
    • ►  August (1)
    • ►  March (1)
  • ►  2015 (3)
    • ►  February (1)
    • ►  January (2)
  • ►  2014 (9)
    • ►  July (1)
    • ►  June (3)
    • ►  May (3)
    • ►  April (1)
    • ►  March (1)
  • ►  2013 (13)
    • ►  December (3)
    • ►  September (2)
    • ►  August (2)
    • ►  June (1)
    • ►  April (1)
    • ►  January (4)
  • ▼  2012 (19)
    • ►  November (3)
    • ▼  October (9)
      • nginx: try_files, proxy_pass and rewrite
      • python: import a custom file
      • python: import function
      • linux: logging top processes by cpu or memory
      • bash script: arithmetic comparison
      • linux: complete command
      • rsync - folder to folder
      • linux: RANDOM is so simple
      • Shell script thingy
    • ►  July (1)
    • ►  June (2)
    • ►  May (2)
    • ►  March (1)
    • ►  January (1)
Simple theme. Powered by Blogger.