Operating System - HP-UX
1834504 Members
3180 Online
110068 Solutions
New Discussion

How to back special characters value into a script

 
Manuales
Super Advisor

How to back special characters value into a script

There is a script that calls a function:It is fun_getreply $interface_in reply*_\$\{a\}.pgp nsfod igual

variable1 value is: /home/user1
variable2 value is: reply*_${a}.pgp

when the function creates a file for sending informatio by FTP , it is created as follows:

Function:
function fun_getreply
{
.....................
.....................
.....................

for a in `cat ${interface_exe}/FLAGS/files_${interface_name}_for_while`
do
"here is created a file that contain information
for being connected to a remote server this file is named ftp.information"

......................
......................
......................
'end of function
}
ftp.information contains:

user pruebas pruebas
binary
prompt off
dir reply*_${a}.pgp
bye

I need that ${a} takes the value that must be taken according with the for abowe showed.

the file has to say:
user pruebas pruebas
binary
prompt off
dir reply*_company_one.pgp
bye

Please HELP ME ... :O)
3 REPLIES 3
Manuales
Super Advisor

Re: How to back special characters value into a script


company_one is contained into file named:

${interface_exe}/FLAGS/files_${interface_name}_for_while


how can i do that?
Manuales
Super Advisor

Re: How to back special characters value into a script

I did the following:

if [[ -n `echo $2 | grep \$\{Z\}` ]] then

p1=`echo $2 | cut -d"\$\{Z\}" -f1`
p2=`echo $2 | cut -d"\$\{Z\}" -f2| sed 's/{Z}//g'`
echo p1 vale: $p1
echo p2 vale: $p2
echo "dir ${p1}${a}${p2}" >> ${interface_exe}/.conect_${interface_name}

else
echo "dir $2" >> ${interface_exe}/.conect_${interface_name}
fi

I changed value input, i mean, Z instead of a and after that i separate the values ....

do you know an easier way to do that?

Please let me know ...
Arturo Galbiati
Esteemed Contributor

Re: How to back special characters value into a script

Hi,
can you attach your script?
It would be easy for me debug it and help you.
Rgds,
Art