# Getting user input within Makefile

If you want to get user input from within a Makefile, ensure you run the read command in one line. It turns out that each line is run in its own subshell. So if you read in user input, ensure you have semicolons and backslashes to ensure commands are run in the same subshell.

This is important because subshells don’t share local variables.

Here is a minimal example.

do :
@echo "What is your age?: "; \
echo "Your age is ", (AGE)