I am creating a password generator however I am not get the passwords to append properly.Here is my scripti=0while [ $i -lt 5 ]do    echo -n '#' >> passwords.txt && openssl rand -hex 4 >> passwords.txt && echo -n '/' >> passwords.txt && echo -n 'X' >> passwords.txt    i=$[$i+1]doneOutput#b887e0d0/X#7093289e/X#2210cfcd/X#fd175e1f/X#0c18fc9e/XExpected Output#b887e0d0/Z#7093289e/Z#2210cfcd/Z#fd175e1f/Z#0c18fc9e/ZHow can I make it so that it doesn't skip that first line and also so that it runs each command in that order and will write to the passwords txt file as the expected output.Thanks.
Appending Echo [Password Generator]
bash;osx;echo;random;hex
This should do:for i in {1..5}; do    printf '#%s/Z\n' $(openssl rand -hex 4)done >passwords.txtI replaced the multiple calls to echo with a single call toprintf. Having the call to openssl wrapped inside a commandsubstitution has the side effect of making the line ending disappear,and that newline character was the cause of the badly-placed line breaksvisible in your example.