delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/11/22/14:45:15

X-Spam-Check-By: sourceware.org
Message-ID: <BAY104-F35726095F31831963AF48DAD520@phx.gbl>
X-Sender: rbody99 AT hotmail DOT com
In-Reply-To: <43836BB9.F79C8D4@dessent.net>
From: "Robert Body" <rbody99 AT hotmail DOT com>
To: cygwin AT cygwin DOT com
Subject: escape codes for ksh in /etc/profile ... was Re: mkpasswd, mkgroup - initial
Date: Tue, 22 Nov 2005 12:45:00 -0700
Mime-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

**************************
First, let me say... Cygwin is awesome, and the mailing lists are awesome.
It looks like a lot of work has been done to make it match a real unix.
:-)
**************************

Brian, another great help, thank you, especially for thelink:
--- http://cygwin.com/faq/faq.setup.html#faq.setup.home
HOME is determined as follows in order of decreasing priority:
1. HOME from the Windows environment, translated to POSIX form.
2. The entry in /etc/passwd
3. HOMEDRIVE and HOMEPATH from the Windows environment
4. /
---------
so, %HOME% variable set in Windows takes priority over  /etc/passwd
That has puzzled me for a few days because all the unix people say
"yup, change the user entry in /etc/passwd and that's your new home"

#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
Actually, yes I can make my own group in cygwin :-)
(just needs a little unix stuff)
i called it "local" and set the group number of 10546 arbitrarily (a number 
not already used... and this is regular unix way of doing it)
--------------------
cat /etc/group
...
local:S-1-5-32-545:10546:robert.body
--------------------


and then in /etc/passwd, the 4th field I set to my newly created "local" 
group
--------------------
cat /etc/group
...
robert.body:unused_by_nt/2000/xp:13550:10546:
robert.body,U-DEN\robert.body,S-1-5-21-1659004503-484061587-839522115-3550:
/cygdrive/c/home/Owner:/bin/bash
--------------------

and then ... ta-daaaa ... my own group of "local"

/cygdrive/c/cygwin/home/Owner> touch 1; ls -alp 1
-rw-r--r--  1 robert.body local 0 Nov 22 12:17 1
/cygdrive/c/cygwin/home/Owner>
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--

I don't suppose there is a way of NOT letting %HOME% take priority over 
"/etc/passwd" for my home directory?

Brian,since you know about so many things, how come the following ksh 
doesn't work in
1) Linux xyz 2.4.7-10 #1 Thu Sep 6 17:27:27 EDT 2001 i686 unknown
2) HP-UX xyz B.11.00 U 9000/785 2004606272 unlimited-user license

the PS1 line below puts path into the title of the xterm, and puts "$PWD" 
into prompt
and this works fine in bash (different section of /etc/profile), but not in 
ksh

---------taken from cygwin's /etc/profile--------------------
...
ksh*     | -ksh*     | */ksh* | \
ksh*.exe | -ksh*.exe | */ksh*.exe )
        # Set a HOSTNAME variable
        typeset -l HOSTNAME

        # Set a default prompt of: user AT host and current_directory
        PS1='^[]0;${PWD}^G
^[[32m${USER}@${HOSTNAME} ^[[33m${PWD}^[[0m
$ '
-------------------------------------------------------------
Basically the escape codes are being ignored in ksh, but it came from 
cygwin's /etc/profile so it must be perfect right?
(i set USER=me and HOSTNAME=myserver
(I execute t2, copied cygwin file with the above):

1) cygwin-----------------running pdksh from today's setup.exe-------
$echo $0
ksh
$. /etc/profile
^[]0;/cygdrive/u^G
^[[32mrobert DOT body AT dpc6528 ^[[33m/cygdrive/u^[[0m
$

2) linux-----------------------------------
$. t2
^[]0;/tmp^G
^[[32mme AT myserver ^[[33m/tmp^[[0m
$

3) hp-----------------------------------
$. t2
^[]0;/OnSight/opscntl^G
^[[32mme AT myserver ^[[33m/OnSight/opscntl^[[0m
$
-----------------------------------------

-Robert



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019