Hack Forums
Stuck with bash script - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Computing (https://hackforums.net/forumdisplay.php?fid=88)
+---- Forum: Linux (https://hackforums.net/forumdisplay.php?fid=85)
+---- Thread: Stuck with bash script (/showthread.php?tid=5828923)



Stuck with bash script - Domyos - Apr 24, 2018

Hey guys,

so i'm creating a script that automates the creation of a website & adding a ftp user & mysql user.
The problem i'm having is whenever i pass the password to the docker container, the password will never be fully in the config file.
example: https://gyazo.com/1f1ad56c59e98ce833e99ab75656440d

How can i make the script ignore all the $ symbols in the password to make it work?
Its probably not the best way to do it but heres what i got to create it

Code
    pass=$(openssl passwd -1 ${password})
    docker exec ftp-server sh -c "echo ${user,,}:\\${pass} >> /conf/vsftpd/virtual_users"

It ignores the first $, but not the other ones.

I hope that someone can help me out.

Thanks


RE: Stuck with bash script - archangel.dmitry - Apr 24, 2018

The problem could be in "\\$" as it forces to always print "\$" as symbols.


RE: Stuck with bash script - Domyos - Apr 24, 2018

(Apr 24, 2018 05:27 AM)archangel.dmitry Wrote:  The problem could be in "\\$" as it forces to always print "\$" as symbols.

Even if i remove the \\ i still have the same problem, it then even gives empty passwords


RE: Stuck with bash script - archangel.dmitry - Apr 24, 2018

Make sure you assign user variable.