Skip to content

Instantly share code, notes, and snippets.

@ceclinux
Created September 10, 2013 04:38
Show Gist options
  • Save ceclinux/6505054 to your computer and use it in GitHub Desktop.
Save ceclinux/6505054 to your computer and use it in GitHub Desktop.
#!/bin/bash
A=B
export A
echo "PID for 1.sh before exec/source/fork:$$"
echo "1.sh: \$A is $A"
case $1 in
exec)
echo "using exec..."
exec ./2.sh ;;
source)
echo "using source..."
. ./2.sh ;;
*)
echo "using fork by default..."
./2.sh ;;
esac
echo "PID for 1.sh after exec/source/fork:$$"
echo "1.sh: \$A is $A"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment