diff options
| author | Mattias Andrée <m@maandree.se> | 2026-02-22 12:57:32 +0100 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-02-22 12:57:32 +0100 |
| commit | 9426b3700ec7b8ebc288c51efc6e185db7fd7e27 (patch) | |
| tree | 69f36264eeb09478f3a64ffbeb00e35385dbd032 | |
| parent | Fix parsing of options with arguments (diff) | |
| download | sshexec-master.tar.gz sshexec-master.tar.bz2 sshexec-master.tar.xz | |
Signed-off-by: Mattias Andrée <m@maandree.se>
| -rw-r--r-- | README | 40 | ||||
| -rw-r--r-- | sshexec.1 | 30 | ||||
| -rw-r--r-- | sshexec.c | 10 |
3 files changed, 40 insertions, 40 deletions
@@ -9,25 +9,25 @@ SYNOPSIS DESCRIPTION The sshexec utility is a wrapper for SSH that makes it easy to - run commands directly in the SSH command. + run commands directly in the SSH command line. sshexec passes any argument after } to ssh-command (ssh if not - specified), but it rewrites command and the arguments to one + specified), but it rewrites command and the arguments into one argument that can be passed into ssh(1) to describe each argument - as separate arguments. It may also rewrite destination to remove - information that's not supported by ssh(1) and inserts extra + as a separate argument. It may also rewrite destination to remove + information that is not supported by ssh(1) and insert extra arguments after it (it may also add a -- argument immediately - before destination) to cause the remote shell it change working + before destination) to cause the remote shell to change working directory to directory, if specified, and execute the provided command and arguments as a regular command rather than as shell - code joined by together by spaces. + code joined together by spaces. OPTIONS sshexec options may be placed at the very beginning enclosed with the arguments { and }. sshexec options, if any, shall be placed in the same { }-group. Any other option will be passed as is to the ssh(1) utility or ssh-command. The sshexec utility - has a build it list of options recognised by the ssh(1) utility + has a built-in list of options recognised by the ssh(1) utility and will not allow anything matching this list. The sshexec utility does not allow mixing options and operands: no option may be placed after destination, such options will be treated @@ -107,24 +107,24 @@ OPTIONS asis=asis-marker Any argument equal to asis-marker will be skipped over and instead the next argument (regardless of whether - it to is equal to asis-marker) will be interpreted as + it too is equal to asis-marker) will be interpreted as a raw shell code string that shall be inserted without escaping. - masis=asis-count - If specified, asis-marker shall only have it's specified - affect up to asis-count times. + nasis=asis-count + If specified, asis-marker shall only have its specified + effect up to asis-count times. OPERANDS The following operands are supported: destination The destination to connect and log into. It shall be - eitherin the form [user@]hostname[:directory] or in the + either in the form [user@]hostname[:directory] or in the form ssh[exec]://[user@]hostname[:port][/directory]. user shall be the name of the remote user. If not - specified, the name of the local user running the + specified, the name of the local user running the utility will be used. hostname shall be the address to the remote machine. @@ -132,24 +132,24 @@ OPERANDS port shall be the port or service name for the port to connect to on the remote machine. - directory shall be directory to change the remote - working directory. This is an alternative to (with the + directory shall be the directory to change the remote + working directory. This is an alternative (with the exact same behaviour) to the dir option and cannot be combined with it. command [argument] ... Whereas the ssh(1) utility would simply join the command and argument arguments with a space between each of - them as pass it to the remote shell for execution, the - sshexec utility forces the remote shell to treat each - of the as separate arguments and cause the shell to - executing them as a non-builtin command. + them and pass the result to the remote shell for execution, + the sshexec utility forces the remote shell to treat each + of them as a separate argument and causes the shell to + execute them as a non-builtin command. command must not contain an equals sign (=) or be just a dash ("-"). ENVIRONMENT VARIABLES - The following environment variables affects the execution of + The following environment variables affect the execution of sshexec: PATH @@ -22,7 +22,7 @@ sshexec - run a command through ssh(1) with normal command syntax The .B sshexec utility is a wrapper for SSH that makes it easy to run commands -directly in the SSH command. +directly in the SSH command line. .PP .B sshexec passes any argument after @@ -37,24 +37,24 @@ and the .IR argument s to one argument that can be passed into .BR ssh (1) -to describe each argument as separate arguments. +to describe each argument as a separate argument. It may also rewrite .I destination -to remove information that's not supported by +to remove information that is not supported by .BR ssh (1) -and inserts extra arguments after it +and insert extra arguments after it (it may also add a .B -- argument immediately before .IR destination ) -to cause the remote shell it change working directory to +to cause the remote shell to change working directory to .IR directory , if specified, and execute the provided .I command and .IR argument s as a regular command rather than as shell code joined -by together by spaces. +together by spaces. .SH OPTIONS .B sshexec @@ -73,7 +73,7 @@ utility or .IR ssh-command . The .B sshexec -utility has a build it list of options recognised by the +utility has a built-in list of options recognised by the .BR ssh (1) utility and will not allow anything matching this list. The @@ -215,7 +215,7 @@ Any equal to .I asis-marker will be skipped over and instead the next argument -(regardless of whether it to is equal to +(regardless of whether it too is equal to .IR asis-marker ) will be interpreted as raw shell code string that shall be inserted without escaping. @@ -223,7 +223,7 @@ shall be inserted without escaping. .BI masis= asis-count If specified, .I asis-marker -shall only have it's specified affect up to +shall only have its specified effect up to .I asis-count times. @@ -249,8 +249,8 @@ shall be the port or service name for the port to connect to on the remote machine. .I directory -shall be directory to change the remote working directory. -This is an alternative to (with the exact same behaviour) +shall be the directory to change the remote working directory. +This is an alternative (with the exact same behaviour) to the .B dir option and cannot be combined with it. @@ -262,11 +262,11 @@ utility would simply join the .I command and .I argument -arguments with a space between each of them as pass it +arguments with a space between each of them and pass the result to the remote shell for execution, the .B sshexec -utility forces the remote shell to treat each of the -as separate arguments and cause the shell to executing +utility forces the remote shell to treat each of them +as a separate argument and causes the shell to execute them as a non-builtin command. .I command @@ -284,7 +284,7 @@ utility itself does not use the standard input. None. .SH ENVIRONMENT VARIABLES -The following environment variables affects the execution of +The following environment variables affect the execution of .BR sshexec : .TP .I PATH @@ -61,7 +61,7 @@ struct redirection { /** - * Command being constructor for ssh(1) + * Command being constructed for ssh(1) */ static char *command = NULL; @@ -191,7 +191,7 @@ build_command_escape(const char *arg) return; } - /* If the string only contains safe characters, add it would escaping */ + /* If the string only contains safe characters, add it without escaping */ while (IS_ALWAYS_SAFE(arg[n])) n += 1; if (!arg[n]) { @@ -201,10 +201,10 @@ build_command_escape(const char *arg) /* Escape string, using quoted printf(1) statement */ build_command_asis("\"$(printf '"); - goto start; /* already have a count of safe initial characters, let's add them immidately */ + goto start; /* already have a count of safe initial characters, let's add them immediately */ while (*arg) { - /* Since process substation removes at least one terminal - * LF, we must hold of on adding them */ + /* Since process substitution removes at least one terminal + * LF, we must hold off on adding them */ if (*arg == '\n') { lfs += 1; arg = &arg[1]; |
