This question already has an answer here:
I want my bash script to read parameters from config file. Here is what inside the script:
#!/bin/bash
source /home/myscript/conf/config.conf
echo "$username"
and below is my config.conf:
username="jonas"
The output when I run the script:
[user@machinename bin]$ . thescript
: No such file or directoryonfig.conf
: command not found
jonas
Here I am confused, though it successfully print "jonas", why is there error "No such file or directory" and "command not found"?
Am I doing something wrong?
No such file or directoryonfig.conf
indicates that something in your script (perhaps a part not shown?) is cutting off/home/myscript/conf/c
from the source command. – Warwick Aug 14 '14 at 5:51