-1

Below is my script where i need to pass the password as parameter

#!/usr/bin/expect -f
set password [lindex $argv 0];
spawn iroot
expect ".* password for"
sleep 3
send "$password\r"
sleep 5
send "dmidecode -t system | grep Manufacturer > /tmp/manufacdetails.txt\r"
send "exit\r"
interact

i tried executing this like below

./getmanufacdetailsTest.sh password123

But it doesn't seems to be working. can you please tell me what i am doing wrong here

  • use `-d` flag to find out where your script is getting stuck. – P.... Apr 29 '19 at 15:21
  • See Vlad's answer or consider to use the [highly popular answer](https://stackoverflow.com/a/14203146/4039619) that explains how to do it in multiple ways, – Sigve Karolius Apr 29 '19 at 16:13

1 Answers1

2

prog.sh:

#!/bin/bash
input=$1
echo "the arg passed to my prog is $1"

In console: ./prog.sh one1
Outputs: one1

Vlad
  • 31
  • 1
  • 4