wouterdebie / i2cssh

csshX like ssh tool for iTerm2
MIT License
547 stars 68 forks source link

No Zero Padding When Using Glob Expansion #70

Closed brando56894 closed 7 years ago

brando56894 commented 7 years ago

When trying to use shell expansion in the FQDN, i2cssh ignores the zero padding when counting through the digits, even if it's specified.

server0{1..9).domain.com will result in connections to server01 to server09 respectively.

server{01..09}.domain.com will result in connections to server1 to server9 respectively, same follows for server{1..9}.domain.com

When I'm trying to shell into 10+ servers this creates an issue where I have to specify server0{1..9}.domain.com server{10..20}.domain.com otherwise the first 9 connections will fail if I did server{1..20}.domain.com.

This isn't an issue with bash because a quick test of echo {01..05} prints 01 02 03 04 05

I can't even tell what version I'm using since there is no form of the version flag apparently, but I cloned the repo only about 2 months ago.

wouterdebie commented 7 years ago

What if you use .. instead of -, as in your bash example? It's bash that does the glob expansion, not i2cssh.

On Aug 5, 2017 23:42, "Brandon Golway" notifications@github.com wrote:

When trying to use shell expansion in the FQDN, i2cssh ignores the zero padding when counting through the digits, even if it's specified.

server0{1-9).domain.com http://domain.com will result in connections to server01 to server09 respectively.

server{01-09}.domain.com http://domain.com will result in connections to server1 to server9 respectively, same follows for server{1-9}. domain.com

When I'm trying to shell into 10+ servers this creates an issue where I have to specify server0{1-9}.domain.com http://domain.com server{10-20}.domain.com http://domain.com otherwise the first 9 connections will fail if I did server{1-20}.domain.com http://domain.com.

This isn't an issue with bash because a quick test of echo {01..05} prints 01 02 03 04 05

I can't even tell what version I'm using since there is no form of the version flag apparently, but I cloned the repo only about 2 months ago.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wouterdebie/i2cssh/issues/70, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKgBrbOBu6pE8DKXn6fdlEnAoMLTPaPks5sVTYFgaJpZM4OuoIO .

brando56894 commented 7 years ago

Sorry for the massively delayed response but I do use the double dots instead of hyphens, which don't work to begin with, IDK why I put them in there, force of habit probably. Edited it above to reflect that.

wouterdebie commented 7 years ago

Have you tried server{01..20}.domain.com? All expansion is done by the shell and i2cssh doesn't ignore anything. Bash does expand with zero padding:

bash-4.4$ echo {01..20}
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20
brando56894 commented 7 years ago

I was going to say "yep" and typed up a long response and was about to post the output of your example...then I realized it also stripped out the 0 🤦‍♂️ I could have swore it was working when I posted this originally.

My version of bash is also pretty ancient it seems, which is odd because our helpdesk just applied a recent OSX upgrade. I'm using OS X Sierra 10.12.6 and my bash version is 3.2.57(1)