Executing versus sourcing a setup script

The file setup.sh has mode rwxr-xr-x and contains these lines:


Shell
#!/bin/bash
cd /tmp/build
PROJECT=alpha


The directory /tmp/build exists, and the variable PROJECT is not set in the user's terminal. With the working directory /home/kai, the user runs:


Shell
./setup.sh
pwd
echo "Project: $PROJECT"


What do the last two commands print?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Bash Scripts Questions: