Reputation: 3
I am creating a script in bash using CYGWIN.
This is essentially what I have:
#!/bin/bash
username=someuser
passwd=someuserpasswd
hostname=thehost
port=1521
sid=dbname
When I concatenate the variables, as in
LOGIN_STR=${username}/${passwd}@${hostname}:${port}/${sid}
echo "Login String = $LOGIN_STR"
The result is:
Login String = $'someuser/someuserpasswd\r@thehost:1521/dbname\r'
To login into sqlplus, obviously this will not work.
I've also tried LOGIN_STR=$username/$passwd@$hostname:$port/$sid
.. Same result.
I understand this probably is related to how Windows handles carriage returns vs Unix. What I'm not clear is what I need to do to cause this to not happen any longer.
Thank you in advance!
Upvotes: 0
Views: 563
Reputation: 1381
Be sure to do this in your .bash_profile or equivalent:
export SHELLOPTS
set -o igncr
This will take care of these types of carriage-return problems inside of Cygwin.
Upvotes: 1