Reputation: 2309
Running into a weird error while writing a shell script.
The following works perfectly fine...
#!/bin/sh
if ssh [email protected] "[ -d /web ]"; then
echo "That directory exists!";
fi
And runs without error. Once I try using variables however...
#!/bin/sh
USER="root"
LOC="example.com"
PATH="/web"
if ssh $USER@$LOC "[ -d $PATH ]"; then
echo "That directory exists!";
fi
it just returns...
6: test.sh: ssh: not found
Even just setting the variables at the top and leaving the bottom hard coded makes it throw this error.
Upvotes: 0
Views: 316