Skip to Content.
Sympa Menu

baslinux - Re: [BL] shell scripting

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: 3aoo-cvfd AT dea.spamcon.org
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] shell scripting
  • Date: Sat, 8 Jan 2005 18:49:23 +1300

sindi keesan wrote:
>
> I notice that BL3 has a file /shell (/etc/shell?)
> listing four shells

Not usually. Perhaps it was installed with one of
your shell packages?

> Is bash the default

bash is normally the default in Linux; however, I
used ash in BL3 to save space. For most purposes
the BL3 version of ash is identical to bash.

> Is SHELL something you set in the environment?

It is usually set automatically (by login). It
can also be set manually.

> Is PS1 a way to set the prompt in ash/bash?

Yes.

> You can use tcsh and probably zsh to correct typos
> in commands or let you edit them (yes/no/edit).

bash (and the BL3 version of ash) also allow you to
edit the commandline.

> to show me where I am here without pwd.
> I don't know why this is not the default.
> Is it the default for ash/bash

No.

> or was it set that way in profile for BL3?

Yes. PS1='\w<\$>'

> There are also ways (at least in zsh) to set it
> to show the time and date.

Also in bash:
----------------------------------------------------
\t the current time in HH:MM:SS format
\d the date in "Weekday Month Date" format
\n newline
\s the name of the shell, the basename of $0
\w the current working directory
\W the basename of the current working directory
\u the username of the current user
\h the hostname
\# the command number of this command
\! the history number of this command
\$ if user is root, a #, otherwise a $
\nnn character corresponding to this octal number
\\ a backslash
\[ begin a sequence of non-printing characters
\] end a sequence of non-printing characters
----------------------------------------------------
Most of those work in ash too.

You can even use colors in the prompt:
--------------------------
PS1='\w\033[31m \$ \033[m'
--------------------------

Cheers,
Steven

____________________________
http://www.basiclinux.com.ru




Archive powered by MHonArc 2.6.24.

Top of Page