I am calling the bash script mkproj.sh by using the command ./mkproj.sh. I also try calling it with arguments: ./mkproj.sh hello but my script returns a null $1 when I put echo "$1" in the script. I am not sure why it won't recognize the command-line arguments.
check_for_file()
{
if [ $# -eq 0 ]; then
local testing_file=myproject
else
local testing_file=$1
fi
if [ -d $testing_file ]; then
echo "Directory name already exists"
exit
else
mkdir -p "$testing_file"/{archive,backups,docs/{html,txt},assets,database,src/{sh,c}}
fi
}
check_for_file
Thank you!