For help: ubuntu, I shell script read_ini. Sh as follows
!/bin/bash
# __readINI [configuration file path + name] [node name] [key]
The function __readINI {
INIFILE=$1; SECTION=$2; The ITEM=$3
# _readIni=` awk -f '=' '/\ [' $SECTION \] {1} a=a==1 & amp; & $1 ~/'$ITEM {print $2; Exit} '$INIFILE `
_readIni=` awk -f '=' "/\ [${SECTION} \] {1} a=a==1" ${INIFILE} | sed -e '1 d' - '^ $/d/e - e'/^ \ [* \], $d '- e "${ITEM}=/^. */! "E" s/d ^ ${ITEM}=//"`
Echo ${_readIni}
}
# to use:
#.net address
Db_url=($(__readINI test. Ini 6 db_url))
Echo ${db_url}
# mail lend
User_name=($(__readINI test. Ini 7 user_name))
Echo ${user_name}
Password=($(__readINI test. Ini 8 password))
Echo ${password}
Upload_path=($(__readINI test. 9 upload_path ini))
Echo ${upload_path}
While:
Do
Echo "for the test dead forreach"
Sleep 3;
The done
Only execute the script./read_ini. Sh is successful, but is nohup error
(base) ubuntu @ - 0-10 to ubuntu VM: ~/$nohup. Huangli/read_ini. Sh & gt; Read_ini. Log 2 & gt; & 1 & amp;
[1] 23031
(base) ubuntu @ - 0-10 to ubuntu VM: ~/huangli $
[1] + Exit 2 nohup./read_ini. Sh & gt; Read_ini. Log 2 & gt; & 1
(base) ubuntu @ - 0-10 to ubuntu VM: ~/huangli $
(base) ubuntu @ - 0-10 to ubuntu VM: ~/huangli $
(base) ubuntu @ - 0-10 to ubuntu VM: ~/huangli $cat read_ini. Log
Nohup: ignoring input
./read_ini. Sh: 1:./read_ini. Sh:!/bin/bash: not found
./read_ini. Sh: 3:/read_ini. Sh: function: not found
Awk: fatal: error reading input file ` - ': Bad file descriptor
./read_ini. Sh: 8:./read_ini. Sh: Syntax error: "} "unexpected