Sample Header Ad - 728x90

Is my "escaping" wrong - or is it something else?

1 vote
2 answers
695 views
Here's what I'm trying to do (in a script):
#!/usr/bin/env bash

if [[ ! $("/usr/bin/scp seamus@fumier.local:/Users/seamus/Downloads/imgutils/image-utils* /home/pi/testscp") ]]; then
    printf "\nERROR & EXIT: 'scp' failed \n"
    exit 1
fi
printf "success!\n"
I've tried doing this in a few ways, but nothing seems to work. Here's what I get from the above:
./testscp.sh: line 3: /usr/bin/scp seamus@fumier.local:/Users/seamus/Downloads/imgutils/image-utils* /home/pi/testscp: No such file or directory

ERROR & EXIT: 'scp' failed
The scp command runs OK when it's on a line by itself. If I do that, I can test for $0 - which works OK... but I'd prefer to do it all in a single line. What am I missing?
Asked by Seamus (3772 rep)
Nov 26, 2024, 09:20 AM
Last activity: Nov 26, 2024, 05:13 PM