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

irom
  • 483
  • 2
  • 10
  • 20

1 Answers1

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.

AdminBee
  • 22,803