Skip to main content

Shell Script (Reading config file)

In a shell script, we can use while loop for reading configurations. Config file is based on value and corresponding parameter.

script.config file is like:
Value1,Parameter1
Value2,Parameter2

And script is like:
#!/bin/sh
cat script.config | while read line
do
parameter=${line%,*}
value=${line#*,}
echo $parameter
echo $value
done

Comments

Popular posts from this blog