Hi,
I have a file as followed :
100.100.100.100
\\server\volume\path\file.pdf
My script :
counter=1
while read -r myline
do
if [ $counter -eq 1]
then
FTPHOST=$myline
fi
if [ $counter -eq 2]
then
SERVERPATH=$myline
fi
counter=$((counter+1))
done < /path/to/inputfile
I want to read each line and put it into variables. My problem is that the path isn't displayed as it should be. (There is one backslash gone !)
the result :
FTPHOST = 100.100.100.100
SERVERPATH = \server\volume\path\file.pdf
Can someone help me out
Thanks
hi frank ,
Could get clear info on your requirement .
Its advisable that you attach a sample file.
what i have understood from your description is you have a file like this :
ipadreees path
ipadress path
and you want to isolate and put ip_addr and paths to variables.
Is this correct ?
Hello, for me, it's working with bash
I've copied your script and added echo $FTPHOST echo $SERVERPATH.
It returns :
100.100.100.100
\\server\volume\path\file.pdf
I just put a space at the end of the lines
if [ $counter -eq 2 ] <-- space between "2" and "]"
@ultimatix
It's a file with 2 lines, one with the ip_adr, the other line with the path.
(file in attach)
@xanthos
Did the path display okay ? The space at the end of the lines was there in my script but not in the post so my guess is that it isn't okay.
Yes I,ve got the two backslash at the beginning,
You can try with #!/bin/bash