marner wrote: > When I use openssh to build up a connection to a ssh server like this: > ssh -myparameter pass user@host "ls -al * | grep .txt" > > I usually get a single line returned like > -rw-r--r-- 1 user group 1223 2007-01-01 08:00 mydata.txt > > Now my question: > Where in the openssh source can I redirect the output of this line from > stdout to a string variable I use? (so I could modify/parse it before > writing it to stdout) In shell you can grab the output of commands put put them into a string using the old backtick `...` style or the newer $(...) style. I suggest the newer style because the quoting rules are easier to understand. var=$(ssh -myparameter pass user@host "ls -al * | grep .txt") Then you can modify the output of ssh as a string and print it or not. Bob _______________________________________________ openssh-unix-dev mailing list openssh-unix-dev@mindrot.org http://lists.mindrot.org/mailman/listinfo/openssh-unix-dev |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: bending openssh output, Peter Stuge |
|---|---|
| Next by Date: | Re: Call for release testing., John Devitofranceschi |
| Previous by Thread: | Re: bending openssh output, Peter Stuge |
| Next by Thread: | sshd leaking processes, Frederik Eaton |
| Indexes: | [Date] [Thread] [Top] [All Lists] |