Re: User name prompt with ssh
From: Greg Wooledge (wooledg_at_eeg.ccf.org)
Date: 09/02/05
- Previous message: Jayson Anderson: "RE: Multiple authorized_keys2 files or how to achieve same effect."
- In reply to: Johan De Meersman: "Re: User name prompt with ssh"
- Next in thread: Jayson Anderson: "Re: User name prompt with ssh"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 2 Sep 2005 14:00:58 -0400 To: Johan De Meersman <jdm@operamail.com>
On Fri, Sep 02, 2005 at 10:54:20AM +0200, Johan De Meersman wrote:
>
> ---begin prompt-ssh.sh---
> #!/bin/bash
> read -p "Please enter your remote username: " SSH_LOGIN
> real-ssh -l "$SSH_LOGIN" $*
> ---end prompt-ssh.sh---
You'll want "$@" (with the quotes) on the end of the last line, not $*. Or
if you use #!/bin/sh instead of bash, you'll want ${1+"$@"} for historical
reasons.
Otherwise, you'll get the wrong results when users pass quoted strings with
spaces in them as arguments to ssh.
"$@" is equivalent to "$1" "$2" "$3"... for however many arguments there are.
"$*" is equivalent to "$1 $2 $3..."
$* or $@ (unquoted) is equivalent to $1 $2 $3...
- Previous message: Jayson Anderson: "RE: Multiple authorized_keys2 files or how to achieve same effect."
- In reply to: Johan De Meersman: "Re: User name prompt with ssh"
- Next in thread: Jayson Anderson: "Re: User name prompt with ssh"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|