| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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 |
| Reply-To: | Cygwin List <cygwin AT cygwin DOT com> |
| Message-Id: | <6.0.1.1.0.20031206201545.02668368@127.0.0.1> |
| X-Sender: | |
| Date: | Sat, 06 Dec 2003 20:21:53 -0500 |
| To: | svartsjel AT gmx DOT net, cygwin AT cygwin DOT com |
| From: | Larry Hall <cygwin-lh AT cygwin DOT com> |
| Subject: | Re: bash loop troubles |
| In-Reply-To: | <20389.1070758668@www55.gmx.net> |
| References: | <20389 DOT 1070758668 AT www55 DOT gmx DOT net> |
| Mime-Version: | 1.0 |
At 07:57 PM 12/6/2003, svartsjel AT gmx DOT net you wrote:
>Hi,
>
>I tried to run the following bash script:
>
>for drive in a b c d e f g h i j k l m n o p q r s t u v w x y z
>do
> alias ${drive}:="cd /cygdrive/${drive}"
>done
>
>I guess, the syntax for the loop is okay, if I replace the alias line with a
>simple echo command:
>
>echo $drive
>
>I get
>
>a
>b
>...
>
>and so on.
>
>Doing the following (both at the prompt and within a bash script):
>
>drive='c'; alias $drive:="cd /cygdrive/$drive"
>
>will lead to the alias as expected. Merely inside the loop it just doesn't
>seem to work.
>Any hints?
You haven't stated what doesn't work about your script as you defined it
above. Works fine for me in bash. Are you running the script as /bin/bash
or as /bin/sh?
From the information given so far, it's not obvious that this is a Cygwin
issue. If this is not a Cygwin-specific issue, it's off-topic for this list.
--
Larry Hall http://www.rfk.com
RFK Partners, Inc. (508) 893-9779 - RFK Office
838 Washington Street (508) 893-9889 - FAX
Holliston, MA 01746
--
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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |