Answer the question
In order to leave comments, you need to log in
How to correctly pass the password and login to the bash script as an argument?
How to correctly pass the password and login to the bash script as an argument?
For example, to connect to a database
Answer the question
In order to leave comments, you need to log in
If this is access to the site database, then parse from its own files. For example, here is Bitrix:
#!/bin/sh
doc_root=~/public_html
dbconn=$doc_root/bitrix/php_interface/dbconn.php
host=`cat $dbconn | grep DBHost | sed 's/.*"\(.*\)".*/\1/'`
username=`cat $dbconn | grep DBLogin | sed 's/.*"\(.*\)".*/\1/'`
password=`cat $dbconn | grep DBPassword | sed 's/.*"\(.*\)".*/\1/'`
database=`cat $dbconn | grep DBName | sed 's/.*"\(.*\)".*/\1/'`
#!/bin/bash
echo $0
echo $1
echo $2
echo $3
./myscript 5 10 15
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question