multishell user profile

2010-04-21 Thread Erik Norgaard

Hi:

I need to create a user profile that works in different shells, 
particularly bash, csh and ksh. It seems that these does not read the 
same files and/or in the same order. So, how do I configure the shell 
profiles without configuring each shell separately?


Also, I can't find information if they use the same syntax, or what 
syntax they share so I can stick to that. Does POSIX specify any of this?


Thanks, Erik
--
Erik Nørgaard
Ph: +34.666334818/+34.915211157  http://www.locolomo.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: multishell user profile

2010-04-21 Thread Odhiambo Washington
On Wed, Apr 21, 2010 at 10:53 AM, Erik Norgaard norga...@locolomo.orgwrote:

 Hi:

 I need to create a user profile that works in different shells,
 particularly bash, csh and ksh. It seems that these does not read the same
 files and/or in the same order. So, how do I configure the shell profiles
 without configuring each shell separately?


Well, each shell reads different files for environment variables, etc.
So just have those files in ~/ and install the shells, then invoke them as
you wish.


-- 
Best regards,
Odhiambo WASHINGTON,
Nairobi,KE
+254733744121/+254722743223
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
If you have nothing good to say about someone, just shut up!.
  -- Lucky Dube
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: multishell user profile

2010-04-21 Thread Matthew Seaman
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 21/04/2010 09:30:54, Odhiambo Washington wrote:
 On Wed, Apr 21, 2010 at 10:53 AM, Erik Norgaard norga...@locolomo.orgwrote:
 
 Hi:

 I need to create a user profile that works in different shells,
 particularly bash, csh and ksh. It seems that these does not read the same
 files and/or in the same order. So, how do I configure the shell profiles
 without configuring each shell separately?


 Well, each shell reads different files for environment variables, etc.
 So just have those files in ~/ and install the shells, then invoke them as
 you wish.

See login.conf(5) -- you can set environment variables for all users
independent of what shell they use.

Cheers,

Matthew

- -- 
Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
  Kent, CT11 9PW
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvOxyAACgkQ8Mjk52CukIwsKwCdFhS+EMLE0iG238ydQnnIesyR
nzcAnRSybbdnQAkfCjGA8HwkLk3WwRLT
=9s6B
-END PGP SIGNATURE-
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: multishell user profile

2010-04-21 Thread Polytropon
On Wed, 21 Apr 2010 09:53:00 +0200, Erik Norgaard norga...@locolomo.org wrote:
 Hi:
 
 I need to create a user profile that works in different shells, 
 particularly bash, csh and ksh. It seems that these does not read the 
 same files and/or in the same order. So, how do I configure the shell 
 profiles without configuring each shell separately?

You can't - at least not very easily.

Of course, you can do as few shell initialisations per se
if you use things like login.conf to set environment variables
instead of manually setting them in the shell config.

The main problem is: The shells you mentioned to use different
formats for their configuration. For example, while you can use

set promptchars = %#
set prompt = %...@%m:%~%# 

for your csh, you have to use a different syntax in bash. The
same goes for aliases.

A chance to partially bypass this is to put as many customization
as possible into script-defined commands that you place in ~/bin
(and add this to $PATH).

Of course, this approach doesn't solve all imaginable problems.

As for reading order of configuration files, refer to the
manpages:

man csh
man bash
man ksh

You will see which files are accessed, and in which order, and
where you can put centrally managed profiles as well as user-
specific profiles.



 Also, I can't find information if they use the same syntax, or what 
 syntax they share so I can stick to that.

They don't use the same syntax. Maybe you'll find a good
comparison chart of shell syntax and capabilities. As stupid
as it may sound, you'll find some information here:

http://en.wikipedia.org/wiki/Comparison_of_command_shells
http://en.wikipedia.org/wiki/Unix_shell




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: multishell user profile

2010-04-21 Thread Karl Vogel
 On Wed, 21 Apr 2010 09:53:00 +0200, 
 Erik Norgaard norga...@locolomo.org said:

E I need to create a user profile that works in different shells,
E particularly bash, csh and ksh.  It seems that these does not read the
E same files and/or in the same order.  So, how do I configure the shell
E profiles without configuring each shell separately?

   The two things that bite me the most often when switching shells are
   environment variables and aliases.  I keep most of my environment stuff
   in a single file ($HOME/.envrc) with entries like this:

  # Local time for RCS date information
  RCSINIT -zLT
  # Default file browser.
  PAGER less

   A small perl script converts this into sh- or csh-style commands, so I
   can just source the appropriate file from .bashrc or .tcshrc or whatever:

  me% cat ~/.envrc.sh
  # Local time for RCS date information
  RCSINIT=-zLT; export RCSINIT
  # Default file browser.
  PAGER=less; export PAGER

  me% cat ~/.envrc.csh
  # Local time for RCS date information
  setenv RCSINIT -zLT
  # Default file browser.
  setenv PAGER less

   Aliases are annoying because the syntax is inconsistent, so I only use
   those for inside-the-shell stuff like job control.  Small ~/bin scripts
   handle things like using dir instead of ls -lF:

  #!/bin/sh
  #dir: long directory listing; skip colors if running script/saveon.
  case $SAVEON in
  ) opt='--color=auto' ;;
  *)  opt='' ;;
  esac
  unset BLOCK_SIZE# throws off the results for GNU ls.
  exec /usr/local/bin/ls -lF $opt ${1+$@}
  exit 1

   Put the invariant stuff in the system startup files.  Something like
   this in /etc/profile would handle a general bash/ksh/sh environment:

  test -f $HOME/.envrc.sh  . $HOME/.envrc.sh

-- 
Karl Vogel  I don't speak for the USAF or my company

If someone has a mid-life crisis while playing hide  seek,
does he automatically lose because he can't find himself?--Steven Wright
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org