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:
. ./import.properties
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.properties
fails because you are not in the C Shell, and because you are not using Bash. The source
command 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). Since source
was not found, we can safely assume your shell does not support it as a built-in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With