| Summary: | ssh-copy-id: strip colon from end of hostname | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Colin Watson <cjwatson> | ||||||
| Component: | Miscellaneous | Assignee: | Assigned to nobody <unassigned-bugs> | ||||||
| Status: | CLOSED FIXED | ||||||||
| Severity: | trivial | CC: | djm, dtucker | ||||||
| Priority: | P2 | ||||||||
| Version: | 5.1p1 | ||||||||
| Hardware: | Other | ||||||||
| OS: | Linux | ||||||||
| URL: | http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=226172 | ||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 1708 | ||||||||
| Attachments: |
|
||||||||
Is the substitution "${1%:}" supported in the standard Bourne shell?
It's not a bashism at any rate, being in POSIX (http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02). I suspect that it is unfortunately not portable to Solaris' anaemic shell. I usually program to POSIX shell where I can, but if ssh-copy-id needs to work on Solaris then I concede that that might be a problem and that it'll need to use command substitution and sed instead. You're right, solaris' /bin/sh doesn't support it:
# a=foo:
# echo ${a%:}
bad substitution
# uname -rs
SunOS 5.8
This, although uglier, works:
host=`echo $1 | sed 's/:$//':`
Created attachment 1909 [details]
openssh-ssh-copy-id.patch
Strip trailing colon from hostname.
BTW solaris' /bin/sh doesn't do tilde expansion either, so it'll not work as a target right now. applied, will be in the 5.6p1 release. Thanks. With the release of OpenSSH 5.6p1 this bug is now considered closed. If you have further problems please reopen or file a new bug as appropriate. |
Created attachment 1573 [details] strip colon from end of hostname When using ssh-copy-id, people often suffix the hostname with a colon, by subconscious analogy with scp. It would be nice to make this silently work. The attached patch does this.