I am trying to run a script remotely (from a bash script), but am having trouble getting the output to redirect locally, for analysis. Running the script is no problem with:
ssh -n -l "$user" "$host" '/home/user/script.sh $params'
However I am unable to capture the output of that script. I have tried the following:
results=$(ssh -n -l "$user" "$host" '/home/user/script.sh $params')
results=`ssh -n -l "$user" "$host" '/home/user/script.sh $params'`
ssh -n -l "$user" "$host" '/home/user/script.sh $params' | grep "what I'm looking for"
ssh -n -l "$user" "$host" '/home/user/script.sh $params' > results_file
Any ideas?