Giter Club home page Giter Club logo

Comments (3)

icy avatar icy commented on May 31, 2024

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.

cmpitg avatar cmpitg commented on May 31, 2024

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.

icy avatar icy commented on May 31, 2024

Totally agreed. I will update it soon :)

from bash-coding-style.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.