Message from discussion
Give an answer to a question that is asked after a command has been run with in a script.
Received: by 10.66.76.38 with SMTP id h6mr717938paw.15.1350016083267;
Thu, 11 Oct 2012 21:28:03 -0700 (PDT)
Received: by 10.68.189.37 with SMTP id gf5mr864465pbc.16.1350016083252; Thu,
11 Oct 2012 21:28:03 -0700 (PDT)
Path: jt13ni4110pbb.1!nntp.google.com!kt20no29134389pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Thu, 11 Oct 2012 21:28:03 -0700 (PDT)
In-Reply-To: <8fb70ac7-3caa-413b-b8f2-25784b3dfa70@googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.55.23.136;
posting-account=HAZC7QoAAABVL-rb29XWk-7RQEt5Hp5Z
NNTP-Posting-Host: 173.55.23.136
References: <8fb70ac7-3caa-413b-b8f2-25784b3dfa70@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <854fad69-020c-47ba-875b-df9f5962b558@googlegroups.com>
Subject: Re: Give an answer to a question that is asked after a command has
been run with in a script.
From: jgonza1...@gmail.com
Injection-Date: Fri, 12 Oct 2012 04:28:03 +0000
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Tuesday, October 9, 2012 2:57:01 PM UTC-7, (unknown) wrote:
> I run a command to start the splunk software and get asked a question. I =
want to be able to answer the question with a y within the script. I have t=
ried to pass in a y but nothing happens, no y gets printed at the end of th=
e question or when I try to redirect a file with the y still nothing happen=
s. See the different code I have tried and output.
>=20
> #!/bin/sh
>=20
> #
>=20
> set -x
>=20
> `/opt/splunkforwarder/bin/splunk start` < /var/tmp/answer
>=20
>=20
>=20
> [root@ct-eng-fmq02-devint tmp]# ./splunk.sh
>=20
> ++ /opt/splunkforwarder/bin/splunk start
>=20
> Do you agree with this license? [y/n]:
>=20
>=20
>=20
> #!/bin/sh
>=20
> #
>=20
> set -x
>=20
> `/opt/splunkforwarder/bin/splunk start` < y
>=20
>=20
>=20
> [root@ct-eng-fmq02-devint tmp]# ./splunk.sh
>=20
> ++ /opt/splunkforwarder/bin/splunk start
>=20
> Do you agree with this license? [y/n]:
>=20
>=20
>=20
> #!/bin/sh
>=20
> #
>=20
> set -x
>=20
> echo "y" | `/opt/splunkforwarder/bin/splunk start`
>=20
>=20
>=20
> [root@ct-eng-fmq02-devint tmp]# ./splunk.sh
>=20
> + echo y
>=20
> ++ /opt/splunkforwarder/bin/splunk start
>=20
> Do you agree with this license? [y/n]:
>=20
>=20
>=20
> #!/bin/sh
>=20
> #
>=20
> set -x
>=20
> `/opt/splunkforwarder/bin/splunk start` |echo "y"
>=20
>=20
>=20
> [root@ct-eng-fmq02-devint tmp]# ./splunk.sh
>=20
> + echo y
>=20
> y
>=20
> ++ /opt/splunkforwarder/bin/splunk start
>=20
> Do you agree with this license? [y/n]:
>=20
>=20
>=20
>=20
>=20
> [root@ct-eng-fmq02-devint tmp]# ./splunk.sh
>=20
> ++ /opt/splunkforwarder/bin/splunk start
>=20
> Do you agree with this license? [y/n]:
>=20
> #!/bin/sh
>=20
> #
>=20
> set -x
>=20
> `/opt/splunkforwarder/bin/splunk start`' <<-EOF >y
>=20
>=20
>=20
> [root@ct-eng-fmq02-devint tmp]# ./splunk.sh
>=20
> ++ /opt/splunkforwarder/bin/splunk start
>=20
> Do you agree with this license? [y/n]:
>=20
>=20
>=20
> #!/bin/sh
>=20
> #
>=20
> set -x
>=20
> `/opt/splunkforwarder/bin/splunk start`' << "y"'
>=20
>=20
>=20
> [root@ct-eng-fmq02-devint tmp]# ./splunk.sh
>=20
> ++ /opt/splunkforwarder/bin/splunk start
>=20
> Do you agree with this license? [y/n]:
>=20
>=20
>=20
> #!/bin/sh
>=20
> #
>=20
> set -x
>=20
> `/opt/splunkforwarder/bin/splunk start`' <<-EOF
>=20
> y
>=20
> EOF
>=20
>=20
>=20
> [root@ct-eng-fmq02-devint tmp]# ./splunk.sh
>=20
> ./splunk.sh: line 5: unexpected EOF while looking for matching `''
>=20
> ./splunk.sh: line 9: syntax error: unexpected end of file
I did run autoexpect -p /opt/splunkforwarder/bin/splunk start and it did cr=
eate a expect script script.exp. I copied that expect scripts(script.exp)to=
another server and ran it it got to this point and hit enter or space bar =
nothing happens. This royally sucks.=20
purposes (which shall include use by consultants, accountants, auditors
and attorneys hired to perform services for you) and only subject to the
following conditions: you may use each Splunk Server with an Enterprise
license to index no more than the peak daily volume of uncompressed data
--More--(16%)