X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Date: Mon, 10 May 2010 15:40:48 +0200 (CEST) From: Luc Hermitte To: Angelo Graziosi Cc: cygwin Message-ID: <33537270.16025181273498847963.JavaMail.root@spooler3-g27.priv.proxad.net> In-Reply-To: <18498144.16024891273498772188.JavaMail.root@spooler3-g27.priv.proxad.net> Subject: Re: Text editor with shell integration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 Hello, "Angelo Graziosi" wrote: > > "lood" wrote : > > Please, read this: http://cygwin.com/acronyms/#PCYMTNQREAIYR Hum ... I missed that. I was used to less stupid mirrors (and a lot of spam...) > > I have written cyg-wrapper.sh to answer this need. > > http://hermitte.free.fr/cygwin/#Win32 > > Very interesting! (That script should be added to Cygwin, as new > package or to cygutils...) Thanks. > Suppose I want a wrapper for: > runas.exe /user:pippo C:\cygwin\Cygwin.bat > to be started as > $ sudos su > I have tried this (in .bashrc): > > ===================== > SU_ARG="/Cygwin.bat" > > sudos() { > opt='' > if [ `expr "$*" : 'su\>'` -gt 0 ] ; then > opt+="`cygpath -p -w "$SU_ARG"`" > fi > cyg-wrapper.sh "/cygdrive/c/WINDOWS/system32/runas.exe" \ > --slashed-opt --binary-opt=-user:pippo $opt > } > ================================= > > but... it does not work :( > > What I am missing!? You missed that my non-old function is bugged. And so did I :( The last case (plain path) shall become: # Plain path or options. case "$1" in [-+]* ) # Option if [ $slashed_opt = 1 ] ; then param[${#param[*]}]="${1/-//}" else param[${#param[*]}]="$1" fi ;; Which can be used this way: $ cyg-wrapper.sh /cygdrive/c/WINDOWS/system32/runas.exe --slashed-opt --cyg-verbose=2 -user:pipo "$@" However, a little bit more work is necessary. The first argument to the function/alias shall be tested. If it is found in $PATH, it shall be left unchanged, otherwise, it shall be translated as well. Or just always translated with $(which $1) may be. -- Luc Hermitte http://lh-vim.googlecode.com/ http://hermitte.free.fr/vim/ -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple