Skip to Content.
Sympa Menu

baslinux - Re: [BL] shell scripting

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: sindi keesan <keesan AT sdf.lonestar.org>
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] shell scripting
  • Date: Sat, 8 Jan 2005 04:20:00 +0000 (UTC)

On Sat, 8 Jan 2005 3aoo-cvfd AT dea.spamcon.org wrote:

sindi keesan wrote:

zsh gives me \w<\$>

It appears that zsh is reading /etc/profile
because that's where PS1 (the prompt string)
is set to \w<\$>

For bash and ash, \w means: current directory
Apparently for zsh, \w means: \w

It is possible to design /etc/profile to feed
different shells. For example:
------------------------------------
if [ "$SHELL" = "/bin/ksh" ]; then
PS1="! $ "
elif [ "$SHELL" = "/bin/zsh" ]; then
PS1="%n@%m:%~%# "
else
PS1='\w<\$>'
fi
------------------------------------
The above will only work if $SHELL correctly
shows /bin/ksh and /bin/zsh for those shells.
You might want to check that first:
-----------
echo $SHELL
-----------

I notice that BL3 has a file /shell (/etc/shell?) listing four shells not including ksh or bash which I think are: csh, tcsh, ash, zsh. I ran into something on the web saying you need to have all the shells you use listed in that file in order for ftpd to work properly. Is bash the default, and that is why you did not include it? I have these other four plus bash (csh being a link to tcsh) but not ksh. Supposedly you can run ksh from zsh but I have no idea how to do that - do I just make a symlink and type ksh (like typing e3pi to run e3 in pico mode)?

How would I modify your above script to set up also tcsh/csh to show the working directory at login rather than just #? I will try echo $SHELL tomorrow on the laptop computer where I put the shells. Is SHELL something you set in the environment? (I might try it here at sdf under NetBSD).

Just learning to understand the above script will be a good start at learning shell scripting. Or is this not a shell-specific script but just a generic script? Do I run this from any shell when logging in, as part of profile?

Is PS1 a way to set the prompt in ash/bash? I ran across setprompt=" " for zsh but it probably goes into some zsh-specific file like .zshenv or the like. zsh had three levels of prompts that occur in different circumstances. I will see if one of the links for beginners at your site or in the default links hotlist has a good intro to shells.

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


Cheers,
Steven

____________________________
http://www.basiclinux.com.ru
_______________________________________________
BasLinux mailing list
BasLinux AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/baslinux


keesan AT sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org




Archive powered by MHonArc 2.6.24.

Top of Page