if [ !-f /tmp/foo.txt ]; thenecho"File not found!"fi
Find all files with specific extension of a directory and its subdirectories
find.-typef-name"*.conf"
Parse file with shell script
#!/bin/shset-ecmd="/usr/local/bin/docker-entrypoint.sh"configFile="/usr/config/memcached.conf"# parseConfig parse the config file and convert it to argument to pass to memcached binaryparseConfig() { args=""whileread-rline|| [ -n"$line" ]; docase $line in-*)# for config format -c 500 or --conn-limit=500args="$(echo "${args}" "${line}")";;[a-z]*)# for config format conn-limit = 500trimmedLine="$(echo "${line}" |tr-d '[:space:]')"#trimallspacesfromtheline(i.econn-limit=500) param="$(echo "--${trimmedLine}")"# append -- in front of trimmedLine (i.e --conn-limit=500) args="$(echo "${args}" "${param}")" ;; \#*)# line start with ## commented line, ignore it;;*)# invalid formatecho"\"$line\" is invalid configuration parameter format"echo"Use any of the following format\n-c 300\nor\n--conn-limit=300\nor\nconn-limit = 300"exit1;;esacdone<"$configFile" cmd="$(echo "${cmd}" "${args}")"}# if configFile exist then parse it.if [ -f"${configFile}" ]; thenparseConfigfi# Now run docker-entrypoint.sh and send the parsed configs as arguments to it$cmd