Im getting int value a and b using scrip1.sh and then trying to pass those values to another script (say script2.sh) which is inside script1.sh and where script2.sh which has a url and which is expecting this variables anb eg. http://download- $a-$b/. In my script that url is not getting my input variables.
read "Enter Build date: " a
read "Enter build No: " b
bash /root/script2.sh $a $b
Don't add any other statement with read.
Try like this,
In script1.sh
#!/bin/bash
echo "Enter Build date: "
read a
echo "Enter build no: "
read b
bash /root/script2.sh $a $b
In script2.sh
#!/bin/bash
a=$1
b=$2
echo "http://download-$a-$b/."
NOTE: echo " http://download- $a-$b/." is just for reference to show the value. You can do your desired operation after getting value.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.