LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Shell tip: trying new shells

[ILUG] Shell tip: trying new shells

kevin lyda kevin at ie.suberic.net
Mon May 15 11:52:29 IST 2006


This tip is incredibly obvious, yet sometimes people don't think to do
it.

A shell is just a program - like ls, vim, man, gcc or all the other
residents of bin/ directories.  If you want to try a new one, just run
it.

There are two main reasons to try a different shell than the one
you're running.  First, you're considering switching to a new shell.
All the kewl kidz are using foosh and you don't want to be left out.
Alternatively you use something other than bash (or sh) and need to make
sure your shell-fu is correct for a shell script you're writing.

Shells, like any unix program, inherit their environment.  But that can
cause problems.  My prompt in zsh is controlled by the environment var
PS1 - which is what bash uses too.  The difference being that they use
completely different escapes.  So it's best to clean your environment -
luckily there's the env command.

To get something close to what it would be like to login with a new
shell, use the env command:

    env -i bash -l

Most shells interpret -l to mean login shell.

This can also work for trying out shell constructs - but you won't have
access to your shell's history.  For that you can just prefix with bash
-c and wrap it in quotes:

    bash -c 'for f in $(seq 1 5); do echo $f; done'

Obviously your shell's quoting rules apply.  For anything complex it's
best to just make a small shell script.

Kevin

-- 
Kevin Lyda                US Citizen Abroad?  Had Enough?  Register
kevin at ie.suberic.net      **** to vote: www.VoteFromAbroad.org ****



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell