Advanced

Using Functions in a BASH Prompt

Posted by jayrfink on · 2 comments
systhread.net; By Jason (Jay) R. Fink
Mail this story
Print this story

One of theneat things a user can do on Unix is play around with the Bourne Again Shell (bash). An even more interesting thing is how the environment can be tweaked to a particular user's preference. In this text a look at how the Bash prompt can be manipulated by inserting commands and even shell code functions directly into the prompt itself.

A Sample Function inline with Bashprompt

In a recent text configuring colors for the Bash prompt was discussed. In this text a method of messing with the prompt is expanded upon by actually inserting a shell code function inline with the bash prompt. A Basic Bash Prompt

The bash prompt has built in commands that use escape charachter syntax. By default a lot of packages ship bash with a default that shows the hostname and relative path. The escape sequences for all users is usually kept in /etc/bashrc or a similar system location.

See the rest of the article for more info.

Full Story

  Nav
» Read more about: Story Type: Tutorial; Groups: Community, Debian, Fedora, Fedora Legacy, Gentoo, Linux, LXer, Slackware, SUSE, Ubuntu

» Get new stories by e-mail: nightly or as they are published

« Return to the newswire homepage

  Related stories
» More like this

Comments (2)

I love stuff like this. I think anyone wanting to learn to write programs should start with a good deep dive into Bash. You can do an amazing lot of things with plain ole Bash guff!
>I think anyone wanting to learn to write programs should start with a good deep dive into Bash.

Thank you for reaffirming my belief with that statement. Now all I have to do is try it. I'll get around to it... some day.

Post a comment

A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.

Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help

Sign up and post (it is free)  or  Log in and post