# how i can input string from variable

**URL:** <https://community.unix.com/t/how-i-can-input-string-from-variable/280193>\
**Category:** Solaris\
**Created:** [January 4, 2011, 10:17pm UTC](https://community.unix.com/t/how-i-can-input-string-from-variable/280193 "2011-01-04T22:17:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![infjustice](https://community.unix.com/letter_avatar/infjustice/32/6_22734026db12803ebb3e059622ac3534.png) [@infjustice](https://community.unix.com/u/infjustice)\
**Post date:** [January 4, 2011, 10:17pm UTC](https://community.unix.com/t/how-i-can-input-string-from-variable/280193/1 "2011-01-04T22:17:44Z")

</div>

hello every body  
my system is solaris 8 and my problem is i have a lot of user to change password so i'm key password every user and i want to input password from variable  
my script  
grep xxx shadow |while read a  
do  
passwd $a  
done  
#new password : i'm typing manual but i want input from $a

```
Pls Help me  
                             thank you Best regrad
                                  infjustice

```

I'm sorry if message not understand i'm weak in english

---

<div class="post-metadata">

**Author:** ![ctsgnb](https://community.unix.com/letter_avatar/ctsgnb/32/6_22734026db12803ebb3e059622ac3534.png) [@ctsgnb](https://community.unix.com/u/ctsgnb)\
**Post date:** [January 6, 2011, 9:50am UTC](https://community.unix.com/t/how-i-can-input-string-from-variable/280193/4 "2011-01-06T09:50:08Z")

</div>

I didn't try it so it may need some adjustement but maybe something like

```nohighlight
grep xxx shadow |while read a 
        do
        echo "Enter passwd for user $a :"
stty -echo
read s
stty echo
echo "$s" | passwd $a
        done

```

?

---

<div class="post-metadata">

**Author:** ![infjustice](https://community.unix.com/letter_avatar/infjustice/32/6_22734026db12803ebb3e059622ac3534.png) [@infjustice](https://community.unix.com/u/infjustice)\
**Post date:** [January 6, 2011, 9:03pm UTC](https://community.unix.com/t/how-i-can-input-string-from-variable/280193/5 "2011-01-06T21:03:47Z")

</div>

Thank you sir

---------- Post updated at 09:03 PM ---------- Previous update was at 08:40 PM ----------

no not work your script not automate input password thank you very much sir
