Unix variables - The correct way -
is recommended way of writing shell script?
#!/bin/bash var_version_number = "x.y" cd /path/to/var_version_number
no, correct way:
#!/bin/bash var_version_number="1.3" cd /path/to/file/${var_version_number}/more/path
the things missing example:
- dollar sign ($) in front of variable name (var_version_number).
- there should no space between variable name , equal sign (=) in assignment.
- it practice surround variable name in curly braces, not needed here.
also note once script on , shell exits, original directory started in. effect of cd
command limited shell script running in, not shell launching script from.
Comments
Post a Comment