ls -ltrq res.file
-rwxrwxr-x 1 ora install 4278 Nov 30 07:19 res.file
$ more test.sh
source res.file
$ ./test.sh
./test.sh[1]: .: res.file: cannot open [No such file or directory]
$ id
uid=600000014(ora) gid=63855(install)
uname -a
SunOS mymac 5.11 11.2 sun4v sparc sun4v
The same thing works fine on a Linux box.
Can you tell me why i m getting No such file or directory error when the file is in the same directory?
Just a small thing here, did you try to get it in a new session, try to login to the server by a new session and have a try then.
EDIT: By seeing your error closely it may be an issue with complete path for source res.file , so is it the case like your script is in a different path and then you have to provide complete path for it, could you please give it a try and let us know then how it goes.
Even though i did not see any special M ^M characters using the cat -ev res.file i did dos2unix res.file res.file and that seems to have resolved the error.
By editing your file in Microsoft Notepad you have inserted carriage return characters which will not be seen in terminal but will be taken as literal parts of filenames, etc by the shell.
The actual error was most likely "can't find myfile.sh\r" or the like.