About the Shell Programming and Scripting category

BSD, Linux, and UNIX shell scripting. Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

1 Like

please, could you explain regarding the following coding in bash shell script and what will be output?:
#!/usr/bin/env bash
set -e
LOGFILE=INSTALL.log
if [ -f $LOGFILE ] ; then
rm $LOGFILE
fi

1 Like

I have a string
jdbc:oracle:thin:@(DESCRIPTION=(ENABLE=BROKEN)(ADDRESS_LIST=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=tcp)(HOST=host01)(PORT=1525))(ADDRESS=(PROTOCOL=tcp)(HOST=host02)(PORT=1525)))(CONNECT_DATA=(SERVICE_NAME=dbservice)))

In my script - want to extract string in above HOST=host01 and HOST=host02 to variables
v_host1(host01), v_host2(host02)
Then same for PORT= and SERVICE_NAME=
v_port (1525) and v_service_nm(dbservice)

How to do this ?
Thanks in advance
Regards
atul

image
for purposes of testing the code i called it script.sh. There's a problem with line 4.