Hello, "Angelo Graziosi" wrote:
> > "lood" <HIDDEN please!> 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