Bash prompt script

In your video 10 Linux Terminal Tips and Tricks to Enhance Your Workflow there is a section about the bash prompt script, which says one should copy it from the blog, but the link to the blog is broken, and the code shown on the screen is not complete. Three scroll sections of the bottom line are shown, but there’s at least one fourth one not shown. Could I get that file?
TIA.

Welcome to the forum!

IDK which video is that (I don’t really watch Jay’s videos, lmao, I’m just spreading knowledge). But a bash prompt script is easy.

Edit the file test.sh and add these:

#!/bin/bash
read -p "insert text: " VAR1
echo ${VAR1}

Then chmod +x test.sh and then run ./test.sh and boom, got your read prompt variable bash script.

Were you looking for something more than this, like some kind of workflow script? That, then Jay would have to answer (or if you link me the video and timestamp, I might be willing to recreate it, if it’s not too big of a hassle - yes, I’m very lazy).

1 Like

Yes; his prompt is the Masseratti of prompts (should I say “Tesla Roadster of prompts”?), with all kinds of bells and whistles. First, it is a two-line prompt, where the first line has the timestamp at which the previous command finished executing, for a time trace in the logs; then it has the number of jobs suspended; then the full current path. The next line has just a ‘|’ prompt. Plus, the choice of colors is exquisite.
10 Linux Terminal Tips and Tricks to Enhance Your Workflow
(I queued the link to play tip #6; the custom prompt.)

I’ve copied from the screen as much as I could see, namely,

BRACKET_COLOR="\[\033[38;5;35m\]"
CLOCK_COLOR="\[\033[38;5;35m\]
JOB_COLOR="\[\033[38;5;33m\]
PATH_COLOR="\[\033[38;5;33m\]
LINE_BOTTOM="\342\224\200"
LINE_BOTTOM_CORNER="\342\224\224"
LINE_COLOR="\[\033[38;5;248m\]
LINE_STRAIGHT="\342\224\200"
LINE_UPPER_CORNER="\342\224\214"
END_CHARACTER="|"

tty -s && export PS1="$LINE_COLORS$LINE_UPPER_CORNER$LINE_STRAIGHT$LINE_STRAIGHT$BRACKET_COLOR[\H:\]$PATH_COLOR\w$BRACKET_COLOR] ... \n$LINE_COLOR$LINE_BOTTOM_CORNER$LINE_STRAIGHT$LINE_BOTTOM$END_CHARACTER\[$(tput sgr0)\] "

But where the ’ … ’ is, I have missing code, never shown on the screen.

I was about to try to reproduce the prompt I would see on the screen with the variables already present, but I didn’t have to.

The URL:
https://learnlinux.link/terminal-tips*%F0%9F%8E%93
which contains an asterisk and an emoji is just a spacing issue.

If you visit this link:
https://learnlinux.link/terminal-tips
you’ll get redirected to this link:

https://www.learnlinux.tv/10-linux-terminal-tips-and-tricks-to-enhance-your-workflow/

And voilà:

BRACKET_COLOR="\[\033[38;5;35m\]"
CLOCK_COLOR="\[\033[38;5;35m\]"
JOB_COLOR="\[\033[38;5;33m\]"
PATH_COLOR="\[\033[38;5;33m\]"
LINE_BOTTOM="\342\224\200"
LINE_BOTTOM_CORNER="\342\224\224"
LINE_COLOR="\[\033[38;5;248m\]"
LINE_STRAIGHT="\342\224\200"
LINE_UPPER_CORNER="\342\224\214"
END_CHARACTER="|"

tty -s && export PS1="$LINE_COLOR$LINE_UPPER_CORNER$LINE_STRAIGHT$LINE_STRAIGHT$BRACKET_COLOR[$CLOCK_COLOR\t$BRACKET_COLOR]$LINE_COLOR$LINE_STRAIGHT$BRACKET_COLOR[$JOB_COLOR\j$BRACKET_COLOR]$LINE_COLOR$LINE_STRAIGHT$BRACKET_COLOR[\H:\]$PATH_COLOR\w$BRACKET_COLOR]\n$LINE_COLOR$LINE_BOTTOM_CORNER$LINE_STRAIGHT$LINE_BOTTOM$END_CHARACTER\[$(tput sgr0)\] "
1 Like

IT WORKS!!! Thank you so much!