Comments (3)
Thanks @cmpitg for your comments.
The problem with #bash is that a variable can't stand with its own name. You have to use a $
to get variable value. Let's see
local _my_var=something
echo "My value is $_my_var, or ${_my_var}. Uppercase version is ${_my_var^^}".
echo "My value is $my_var, or ${my_var}. Uppercase version is ${my_var^^}".
The primary purpose of the underscore (_
) is to create a natural distance between the dollar ($
) and the variable name. I see that helps my code more readable, esp. when I have no color in my viewer.
This is just a convention, and you may follow it , or not. The most important thing to remember is to make sure your code consistent, by not using different styles in the same project;)
from bash-coding-style.
Thanks @icy.
The primary purpose of the underscore (
_
) is to create a natural distance between the dollar ($
) and the variable name. I see that helps my code more readable, esp. when I have no color in my viewer.
This explains it. Would it be better if a brief rationale is added for some section? Some could be subjective, but I think it'd be better to understand the decision at least. Don't you think?
from bash-coding-style.
Totally agreed. I will update it soon :)
from bash-coding-style.
Related Issues (8)
- _underscore as variable name prefix HOT 4
- A webpage about obsolete and deprecated syntax HOT 1
- What about global non environment variables HOT 3
- Ability to fetch private data (private group) HOT 1
- functions names just curious HOT 2
- [Question] What about arrays? HOT 8
- Conversation [ Not an issue ] HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bash-coding-style.