Do I need to include [] around the color code in bash script?Terminal prompt not wrapping correctlybash PS1...

Integer Lists of Noah

Does Lufthansa weigh your carry on luggage?

Is "I do not want you to go nowhere" a case of "DOUBLE-NEGATIVES" as claimed by Grammarly?

Is English unusual in having no second person plural form?

Linking a filetype to a syntax file of a different name

When I press the space bar it deletes the letters after it

How to deal with moral/legal subjects in writing?

What happens to unproductive professors?

Does Multiverse exist in MCU?

Why is the air gap between the stator and rotor on a motor kept as small as it is?

Why doesn't sea level show seasonality?

How do native German speakers usually express skepticism (using even) about a premise?

How can a dictatorship government be beneficial to a dictator in a post-scarcity society?

Are there any medieval light sources without fire?

Is there any reason why MCU changed the Snap to Blip

Astronaut distance from Earth?

Does throwing a penny at a train stop the train?

Why didn't Thanos kill all the Dwarves on Nidavellir?

Difference between scale and grid in QGIS?

Is there a strong legal guarantee that the U.S. can give to another country that it won't attack them?

How do we handle pauses in a dialogue?

Why return a static pointer instead of an out parameter?

How would vampires avoid contracting diseases?

For a hashing function like MD5, how similar can two plaintext strings be and still generate the same hash?



Do I need to include [] around the color code in bash script?


Terminal prompt not wrapping correctlybash PS1 setupUsing tput in $PS1 is breaking line wrappingWhy do we need the “at” command in Linux?Non-printing escape sequence: when?ksh/bash Formatting Files through sed by cat file|sed commandPing: Result shows 56(84) instead of what is expectedRemove all duplicate word from string using shell scriptShould I try to get rid of “Inappropriate ioctl for device” in strace output for a Bash script?Mixing if ..; with { command-grouping} and [[ test ]] and logical operatorsRead lines into array, one element per line using bash






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I was messing around with the color codes trying to understand how color code is used in bash script and I found that it works fine without including [] around it as in here:



This..



red="33[38;5;203m"
export PS1="$redu$green$(__git_ps1)$blue W"


..gives the same result as that:



red="[33[38;5;203m]"
export PS1="$redu$green$(__git_ps1)$blue W"


So is the second form necessary?










share|improve this question







New contributor



mdtair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Possible duplicate of Terminal prompt not wrapping correctly

    – muru
    9 mins ago


















0















I was messing around with the color codes trying to understand how color code is used in bash script and I found that it works fine without including [] around it as in here:



This..



red="33[38;5;203m"
export PS1="$redu$green$(__git_ps1)$blue W"


..gives the same result as that:



red="[33[38;5;203m]"
export PS1="$redu$green$(__git_ps1)$blue W"


So is the second form necessary?










share|improve this question







New contributor



mdtair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Possible duplicate of Terminal prompt not wrapping correctly

    – muru
    9 mins ago














0












0








0








I was messing around with the color codes trying to understand how color code is used in bash script and I found that it works fine without including [] around it as in here:



This..



red="33[38;5;203m"
export PS1="$redu$green$(__git_ps1)$blue W"


..gives the same result as that:



red="[33[38;5;203m]"
export PS1="$redu$green$(__git_ps1)$blue W"


So is the second form necessary?










share|improve this question







New contributor



mdtair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I was messing around with the color codes trying to understand how color code is used in bash script and I found that it works fine without including [] around it as in here:



This..



red="33[38;5;203m"
export PS1="$redu$green$(__git_ps1)$blue W"


..gives the same result as that:



red="[33[38;5;203m]"
export PS1="$redu$green$(__git_ps1)$blue W"


So is the second form necessary?







bash shell-script






share|improve this question







New contributor



mdtair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question







New contributor



mdtair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question






New contributor



mdtair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 12 mins ago









mdtairmdtair

1




1




New contributor



mdtair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




mdtair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • Possible duplicate of Terminal prompt not wrapping correctly

    – muru
    9 mins ago



















  • Possible duplicate of Terminal prompt not wrapping correctly

    – muru
    9 mins ago

















Possible duplicate of Terminal prompt not wrapping correctly

– muru
9 mins ago





Possible duplicate of Terminal prompt not wrapping correctly

– muru
9 mins ago










0






active

oldest

votes














Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






mdtair is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f529323%2fdo-i-need-to-include-around-the-color-code-in-bash-script%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








mdtair is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















mdtair is a new contributor. Be nice, and check out our Code of Conduct.













mdtair is a new contributor. Be nice, and check out our Code of Conduct.












mdtair is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f529323%2fdo-i-need-to-include-around-the-color-code-in-bash-script%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...