[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why difference between interactive+script doing same thing?
From: |
Greg Wooledge |
Subject: |
Re: why difference between interactive+script doing same thing? |
Date: |
Mon, 27 Mar 2023 15:39:52 -0400 |
On Mon, Mar 27, 2023 at 12:24:35PM -0700, L A Walsh wrote:
> interactive:
>
> readarray out< <(ssh -n -T "$user@$host" 'printf "1\n2\n3\n4\n5\n"' 2>&1);
> printf "%s" "${out[@]}"
> In script:
>
> on_host athenae 'printf "1\n2\n3\n4\n5\n"' Using host athenae
> 103: host athenae, up
> Read 1 lines
You aren't showing the actual commands that the script is running, so
we have no way to verify that whatever the script is doing is identical
to what you were doing interactively.
Also:
> readarray output< <(ssh -n -T "$user@$host" "$@" 2>&1)
That "$@" is not going to work the way you want it to in the general
case. The arguments that are passed to ssh to form a command are
pasted together with spaces between them, and then parsed by the remote
shell. This can lead to all kinds of brokenness if you aren't planning
around it. See also <https://mywiki.wooledge.org/BashFAQ/096>.
I don't know whether that's immediately relevant to your stated problem,
but it's definitely a future problem waiting to bite you.
- why difference between interactive+script doing same thing?, L A Walsh, 2023/03/27
- why difference between interactive+script doing same thing?, L A Walsh, 2023/03/27
- why difference between interactive+script doing same thing?, L A Walsh, 2023/03/27
- why difference between interactive+script doing same thing?, L A Walsh, 2023/03/27
- Re: why difference between interactive+script doing same thing?,
Greg Wooledge <=
- [sorry for dups] Re: why difference between interactive+script doing same thing?, L A Walsh, 2023/03/27
- Re: [sorry for dups] Re: why difference between interactive+script doing same thing?, Greg Wooledge, 2023/03/27
- Re: [sorry for dups] Re: why difference between interactive+script doing same thing?, L A Walsh, 2023/03/27
- Re: [sorry for dups] Re: why difference between interactive+script doing same thing?, Greg Wooledge, 2023/03/27
- Re: [sorry for dups] Re: why difference between interactive+script doing same thing?, L A Walsh, 2023/03/28
- Re: [sorry for dups] Re: why difference between interactive+script doing same thing?, L A Walsh, 2023/03/27
why difference between interactive+script doing same thing?, L A Walsh, 2023/03/27