Skip to main content
edited tags
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 267
added 1 characters in body
Source Link
Amelio Vazquez-Reina
  • 43.1k
  • 81
  • 212
  • 300

I am trying to learn loops and array manipulation in zsh.

Say I have two arrays in zsh with the same uknownunknown # of elements and each of them containing a list of paths, e.g.

LOCAL_ARRAY=($LOCAL_PATH_1 $LOCAL_PATH_2 $LOCAL_PATH_3)
REMOTE_ARRAY=($REMOTE_PATH_1 $REMOTE_PATH_2 $REMOTE_PATH_3)

I would like to iterate through both arrays simultaneously with a common index, so that I can do something like:

cd $LOCAL_PATH_i
hg pull $REMOTE_PATH_i

in each iteration. How can I do this in zsh?

Also, I have searched for loop control and arrays in the zsh documentation but had little success. Is there a good tutorial that introduces the basics of loops, arrays, etc. in zsh? Something for people with little bash or shell-scripting experience but with a background in programming?

I am trying to learn loops and array manipulation in zsh.

Say I have two arrays in zsh with the same uknown # of elements and each of them containing a list of paths, e.g.

LOCAL_ARRAY=($LOCAL_PATH_1 $LOCAL_PATH_2 $LOCAL_PATH_3)
REMOTE_ARRAY=($REMOTE_PATH_1 $REMOTE_PATH_2 $REMOTE_PATH_3)

I would like to iterate through both arrays simultaneously with a common index, so that I can do something like:

cd $LOCAL_PATH_i
hg pull $REMOTE_PATH_i

in each iteration. How can I do this in zsh?

Also, I have searched for loop control and arrays in the zsh documentation but had little success. Is there a good tutorial that introduces the basics of loops, arrays, etc. in zsh? Something for people with little bash or shell-scripting experience but with a background in programming?

I am trying to learn loops and array manipulation in zsh.

Say I have two arrays in zsh with the same unknown # of elements and each of them containing a list of paths, e.g.

LOCAL_ARRAY=($LOCAL_PATH_1 $LOCAL_PATH_2 $LOCAL_PATH_3)
REMOTE_ARRAY=($REMOTE_PATH_1 $REMOTE_PATH_2 $REMOTE_PATH_3)

I would like to iterate through both arrays simultaneously with a common index, so that I can do something like:

cd $LOCAL_PATH_i
hg pull $REMOTE_PATH_i

in each iteration. How can I do this in zsh?

Also, I have searched for loop control and arrays in the zsh documentation but had little success. Is there a good tutorial that introduces the basics of loops, arrays, etc. in zsh? Something for people with little bash or shell-scripting experience but with a background in programming?

Tweeted twitter.com/#!/StackUnix/status/126782087637377024
deleted 112 characters in body
Source Link
Amelio Vazquez-Reina
  • 43.1k
  • 81
  • 212
  • 300

Sorry if this question is a bit too elementary, but I am relatively new to shell scripting in zsh in general. I am trying to learn loops and array manipulation in zsh.

Say I have two arrays in zsh with the same uknown # of elements and each of them containing a list of paths, e.g.

LOCAL_ARRAY=($LOCAL_PATH_1 $LOCAL_PATH_2 $LOCAL_PATH_3)
REMOTE_ARRAY=($REMOTE_PATH_1 $REMOTE_PATH_2 $REMOTE_PATH_3)

I would like to iterate through both arrays simultaneously with a common index, so that I can do something like:

cd $LOCAL_PATH_i
hg pull $REMOTE_PATH_i

in each iteration. How can I do this in zsh?

Also, I have searched for loop control and arrays in the zsh documentation but had little success. Is there a good tutorialtutorial that introduces the basics of loopsloops, arraysarrays, etc. in zsh? Something for people with little bash or shell-scripting experience? (I have but with a background in programming though).?

Sorry if this question is a bit too elementary, but I am relatively new to shell scripting in zsh in general. I am trying to learn loops and array manipulation in zsh.

Say I have two arrays in zsh with the same uknown # of elements and each of them containing a list of paths, e.g.

LOCAL_ARRAY=($LOCAL_PATH_1 $LOCAL_PATH_2 $LOCAL_PATH_3)
REMOTE_ARRAY=($REMOTE_PATH_1 $REMOTE_PATH_2 $REMOTE_PATH_3)

I would like to iterate through both arrays simultaneously with a common index, so that I can do something like:

cd $LOCAL_PATH_i
hg pull $REMOTE_PATH_i

in each iteration. How can I do this in zsh?

Also, I have searched for loop control and arrays in the zsh documentation but had little success. Is there a good tutorial that introduces the basics of loops, arrays, etc. in zsh? Something for people with little bash or shell-scripting experience? (I have a background in programming though).

I am trying to learn loops and array manipulation in zsh.

Say I have two arrays in zsh with the same uknown # of elements and each of them containing a list of paths, e.g.

LOCAL_ARRAY=($LOCAL_PATH_1 $LOCAL_PATH_2 $LOCAL_PATH_3)
REMOTE_ARRAY=($REMOTE_PATH_1 $REMOTE_PATH_2 $REMOTE_PATH_3)

I would like to iterate through both arrays simultaneously with a common index, so that I can do something like:

cd $LOCAL_PATH_i
hg pull $REMOTE_PATH_i

in each iteration. How can I do this in zsh?

Also, I have searched for loop control and arrays in the zsh documentation but had little success. Is there a good tutorial that introduces the basics of loops, arrays, etc. in zsh? Something for people with little bash or shell-scripting experience but with a background in programming?

Source Link
Amelio Vazquez-Reina
  • 43.1k
  • 81
  • 212
  • 300
Loading