Mail Archives: cygwin/2004/08/28/06:23:19
------=_NextPart_000_001E_01C48CF9.961EC200
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit
Igor wrote:
> On Fri, 27 Aug 2004, Igor Pechtchanski wrote:
>
>> [snip]
>> Or you could try to get a SYSTEM-owned shell, and remove it from
>> there. FWIW, I have a handy shortcut for that (see below).
>
> Sorry, I forgot to include the promised shortcut. Here it is:
>
> C:\cygwin\bin\bash.exe -c "at $(date +%H):$(($(date +%M) + 1))
> /interactive 'c:\cygwin\bin\bash.exe' --login -i; secs=$((60 -
> $(date +%S))); while [ $secs -ne 0 ]; do echo -ne 'Please wait
> '$secs' seconds for the shell \r'; sleep 1; secs=$(($secs - 1)); done"
>
> Just paste the above line in the "Target:" field of the shortcut.
> What this will do is show a window with the countdown until the
> system-owned login shell pops up. If you want to make it really
> nice, set the width of the shortcut screen buffer (in the Layout tab)
> to 38 and the height to 1.
>
> The above assumes you installed Cygwin in c:/cygwin. If you
> installed it somewhere else, the shortcut needs to be modified
> accordingly.
> HTH,
> Igor
Hmm... I wasn't able to get your shortcut working. First it didn't fit in
the shortcut wizards textbox. Then after having put it in "isysbash.bat" it
failed with
$ isysbash.bat
bash: -c: line 1: unexpected EOF while looking for matching `)'
bash: -c: line 2: syntax error: unexpected end of file
$ cat isysbash.bat
@echo off
C:
cd \Program\Cygwin\bin\
bash.exe -x -c "at $(date +%H):$(( $(date +%M) + 1 )) /interactive
'bash.exe' --login -i; secs=$(( 60 - $(date +%S) )); while [ $secs -ne 0 ];
do echo -ne 'Please wait' $secs 'seconds for the shell \r'; sleep 1;
secs=$(( $secs - 1 )); done"
Counting the parentheses; They match! Heh? What is the problem?
Your scripting also have a problem at hour boundaries. (Launch it
"imaginary" at 11:59 or 23:59). There might also be a problem with "at" not
accepting single digit hours, I'm not as sure about that though.
I've attached my "sysbash", which WFM.
Who knows there might be problems with it too ;-P
(W2K Avd Server, SP4+, CYGWIN=check_case:strict)
/Hannu E K Nevalainen, B.Sc. EE Microcomputer systems --72-->
** mailing list preference; please keep replies on list **
-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--END OF MESSAGE--
------=_NextPart_000_001E_01C48CF9.961EC200
Content-Type: application/octet-stream;
name="sysbash"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="sysbash"
#!/bin/bash
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# (C) 2003 by Hannu E K Nevalainen, Mariefred, Sweden
# Written 2003-09-30.
# Free to use under any circumstances.
# Requires the "cygwin" Unix-on-windows emulation.
#
# This will launch a "SYSTEM" owned bash-prompt in a console window
# at next even minute boundary, according to the windows "clock".
# -NO- options available.
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [ -z "`which at`" ] ;then
echo -e "\nCan't locate the wind-dos \"at.exe\" command."
echo "At this writing it is unknown whether it exists in Win9x."
echo -e "\n\e[41m SCRIPT TESTING HAS BEEN DONE UNDER Win2K, SP4+ ONLY \e[=
m\a\n"
exit 1
fi
# Build the WINDOWS command line to execute
#------------------------------------------
# NOTE: Windows paths DOESN'T need backslash escape conversion!
c=3D"`which bash`"
c=3D"`cygpath -aw $c` --login -i"
c=3D"cmd /c \"$c\""
# Launch it at NEXT while minute...
#----------------------------------
# find out current HH:MM -> h m=20
h=3D`date +%H`
m=3D`date +%M`
# Increase m one step (possibly flipping the hour)
if [ $m -gt 58 ] ;then
m=3D'0'
h=3D$(( ( $h + 1 ) % 24 ))
else
m=3D$(( $m + 1 ))
fi
# Right adjust and zero fill
h=3D"00$h"
h=3D${h: -2}
m=3D"00$m"
m=3D${m: -2}
# Initiate launch, assuming "at" is in the PATH
#----------------------------------------------
at $h:$m /interactive $c
# Display result
#---------------
at
echo -e "\e[31mat id-number /delete \e[0m# <- this will remove a badly =
set job\n \
\e[41m The new SYSTEM owned shell will launch in $(( 60 - $m )) seconds, at=
$h:$m \e[0m"
------=_NextPart_000_001E_01C48CF9.961EC200
Content-Type: text/plain; charset=us-ascii
--
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/
------=_NextPart_000_001E_01C48CF9.961EC200--
- Raw text -