I wrote following script, which generate random password and store it in file
pass1=</dev/urandom tr -dc _A-Z-a-z-0-9|head -c8
echo $pass1
echo "$pass1" >/tmp/a
Above script printing generated password through "echo $pass1" command. But nothing getting stored inside created /tmp/a file .
Please let me know whats wrong i am doing.
It's not necessary to store the password in an intermediate variable. You only need this line in your shell script
I saved as
foo.sh
, made permissions 755, and executed it under linux...