I tried the following two ways to source the property file
#!/bin/sh
. import.properties
echo $USER_ID
echo $INPUT_FILE
It says :
./test.sh[3]: import.properties: not found
when tried using source import.properties it gave the message as:
./test.sh[3]: source: not found.
I am very new to the scripting and env. Please let me know what I am missing here?
To be found by the dot
.command, the file must be readable (not necessarily executable) and on your PATH (and to be safely usable, it must contain shell script).If the file is in your current directory and
.(the directory, not the command) is not on your PATH, you can use:Otherwise, you need to specify the absolute name of the file, or relative name of the file, or move the file to a convenient directory on your PATH.
The alternative notation,
source import.propertiesfails because you are not in the C Shell, and because you are not using Bash. Thesourcecommand in the C Shell is the analogue of the dot command in the Bourne shell. Bash allows it as a synonym for the dot command (or the dot command as a synonym for source). Sincesourcewas not found, we can safely assume your shell does not support it as a built-in.