cat > /home/user/main.erl erl -compile main.erl if [ -f /home/user/main.beam ]; then rm main.erl erl -noshell -s main main -s init stop fi