Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Server-Uuid: 2d3b7162-db1d-11d3-b8ee-0008c7dfb6f1 Message-ID: <718198F862F1D411B10F0002A50A4DB1059FEA43@e90wwce3.dx.deere.com> From: "Polley Christopher W" Reply-to: cygwin AT cygwin DOT com To: "'cygwin AT cygwin DOT com'" cc: "'Jon LaBadie'" Subject: RE: cygwin.bat suggestions Date: Thu, 11 Jul 2002 12:12:03 -0500 MIME-Version: 1.0 X-WSS-ID: 113363E7756980-01-02 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit > -----Original Message----- > From: Jon LaBadie > > On Wed, Jul 10, 2002 at 12:44:19PM -0500, Polley Christopher W wrote: > > > > > From: Jon LaBadie > > > > > > One thing I would like to do is replace "set SHELL=/bin/ksh" with > > > > > > SHELL=$(grep "^${USER}:" /etc/passwd | cut -d: -f7) > > > : ${SHELL:=/bin/ksh} > > > > > > > How about: > > > > ------>8-------- > > @echo off > > > > C: > > chdir \cygwin\bin > > > > rem set SHELL to user's shell (from /etc/passwd) > > bash -c "echo -n 'set SHELL='> temp_setShellEnvVar.bat" > > grep "^%USERNAME%:" /etc/passwd | cut -d: -f7 >> > temp_setShellEnvVar.bat > > call temp_setShellEnvVar.bat > > del temp_setShellEnvVar.bat > > > > rxvt --loginShell -geometry 108x32 -fn 10x20 -sr +ut > > > > ------>8-------- > > > > (window's 'echo' is unable to write to a line without a > crlf at the end, and > > AFAIK, there's no backtick equivalent in batch programming) > > Chris, > first tests show it working. I never considered mixing > cygwin calls in a .bat. > > To save me from learning batch file programming, one last > thing please. > > The possibility exists that column seven in /etc/passwd is > empty (a valid situation). > In that case the code would be setting SHELL= , i.e. a null > value. I'd like to > supply a default (probably /bin/bash). In shell it would be > easy, in batch I > guess it would take an if statement (assuming they exist in > batch). The cumbursome > shell way would be something like: > > if [[ ${SHELL} = "" ]] > then > export SHELL=/bin/bash > fi > > Would something similar be available in batch? A guess: > > if %SHELL% = "" set SHELL=/bin/passwd > This is close, but when doing string comparisons in batch, you need to quote both sides: if "%SHELL%" = "" set SHELL=/bin/bash -Chris -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/