Skip to content

Instantly share code, notes, and snippets.

@asvid
Last active May 3, 2020 13:10
Show Gist options
  • Select an option

  • Save asvid/0eff5148b4c72710f49525e944c799c5 to your computer and use it in GitHub Desktop.

Select an option

Save asvid/0eff5148b4c72710f49525e944c799c5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
ARG_PATH="/"
CONFIG_PATH="/"
if [ ! -z "$ARG_PATH" ]; then # if path was provided as argument
if [ -d "$ARG_PATH" ]; then # check if it exists
echo File exists!
if [ -r $ARG_PATH ] && [ -s $ARG_PATH ]; then
echo This file readable and not empty.
fi
else
echo Provided path not found: $ARG_PATH
exit 1
fi
elif [ -d "$CONFIG_PATH" ]; then
echo At least there is some config file
else
echo Path not provided
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment