0

I am passing arguments to the shell script below ./script.sh pan.tgz 192.168.3.1 ABCXYZ

#!/bin/sh
echo $1 $2 $3
file=$1
host=$2
key=$3

curl -kv -o ${file} 'https://${host}/api/?type=export&category=device-state&key=${key}'

but getting error curl: (6) Could not resolve host: $host

1

1 Answer 1

2

The Advanced Bash scripting guide states in chapter 5 that inside single quotes, the special meaning of $ is turned off, hence no variable expansion is performed. You could try enclosing your curl argument in double quotes " ... " instead of the single quotes.

Not the answer you're looking for? Browse other questions tagged .