Color Variables BASH Shell Script Linux Tutorial

preview_player
Показать описание

Example Script:

Intro Video by Milan Ristic
Комментарии
Автор

if saved file containing color code 'cheats' exists,
you can add a line '. < existing file >' , to your script.
Then have another terminal open with
'less < existing file >' , for reference/copy/paste use.

huhawnawno
Автор

You can set this in your .bashrc file and it'll apply it throughout when you reboot btw

RaveYoda
Автор

0:19 exit codes
0:31 escape codes ( echo -e )
2:42 i just realised that i dont know how to paste in vim 🤨😳
3:06 using `sed` to replace using regex i guess

yash
Автор

Nice!....I mean...I won't have enough time in the day to do this?...but its nice to know it exists!...LOL!

eddieoconnor
Автор

For using it in scripts, just add
if [[ -f "$HOME/.klsh/.klshcore" ]]; then
source $HOME/.klsh/.klshcore -s
fi
to the begining of your script.

mykm
Автор

OT: i miss your Python tutorials. Will you post one for example about subtracting two datetime.datetime objects, which gives you a datetime.timedelta object?

giardia
Автор

Doesn't work for me on OS X :<
When I run in bash: echo '\e[31m red' everything works as it supposed to: the ' red' is red. However, when I try to echo from the sh script itself it outputs the color code ('\e[31m') as a text: so the output is '\e[31m red'.

PhilipBelov
Автор

hello, bonjour, j'ai regardé ta vidéo avec intérêt . Mais l'exemple suivant ne fonctionne pas : echo "${strickthrough }This has a line it" , est-ce que tu peux me dire pourquoi ? Merci, Have a good day.

jpedithe
Автор

I have a big noob question. When you put in $normal how did it know to end the colors when "normal" wasn't defined? For someone like me how would I know to put in $normal instead of just the \e[0m ? Was the choice of $normal just a random decision, like anything you would put after the $ if it's undefined would cancel the last one?

jacquimayton
Автор

hello friend please how can I change the color of the letters of my user root in the terminal in fedora 23 using gnome 3.18 thank you

MrDextre
Автор

the bash on my system uses this:
\[\e[35m\]$MSYSTEM\[\e[0m\] \[\e[33m\]\w\[\e[0m\]\n\$`

i tried breaking it down manually, and i can see:
\e]0
\e]32m
\e[35m
\e[0m
\e[33m
\e[0m

and i cant comprehend how to break it further. can someone assist 😅.
like in c, u break at semi-colon and braces. in html, u break at angle brackets,
how do you break at shell's to make sense of the attributes and properties

yash
Автор

It's dumb that terminals can't handle all of the RGB colors.

BLOOMS