bash のスクリプトを作成する方法を学び始めたところ、echo コマンドと変数で問題が発生しました。
#!/bin/bash
LOGINOUTPUT = "`wget --no-check-certificate --post-data 'login=redacted&password=redacted' https://nessusserver:8834/login -O -`"
echo $LOGINOUTPUT
このスクリプトを実行すると、次が返されます。
--2013-08-15 15:07:32-- https://nessusserver:8834/login
Resolving nessussserver (nessusserver)... 172.23.80.88
Connecting to nessusserver (nessusserver)|172.23.80.88|:8834... connected.
WARNING: cannot verify nessusserver's certificate, issued by ‘/C=FR/ST=none/L=Paris/O=Nessus Users United/OU=Certification Authority for nessusserver.healthds.com/CN=nessusserver.healthds.com/emailAddress=ca@besecmisc1.healthds.com’:
Unable to locally verify the issuer's authority.
WARNING: certificate common name ‘nessusserver.healthds.com’ doesn't match requested host name ‘nessusserver’.
HTTP request sent, awaiting response... 200 OK
Length: 461 [text/xml]
Saving to: ‘STDOUT’
100%[=============================================================================================================================================================>] 461 --.-K/s in 0s
2013-08-15 15:07:33 (90.4 MB/s) - written to stdout [461/461]
./nessus-output.sh: line 2: LOGINOUTPUT: command not found
LOGINOUTPUT がコマンドであると考えるのはなぜですか? 助けてくれてありがとう!
編集:更新されたスクリプト
#!/bin/bash
LOGINOUTPUT=$(wget --no-check-certificate --post-data 'login=redacted&password=redacted' https://nessusserver:8834/login -O -)
echo $LOGINOUTPUT
$(...) をバッククォートのままにしておくと、同じエラーが発生します。