fork download
  1. #!/bin/bash
  2.  
  3. # ideone boilerplate - we can't write files in the home directory;
  4. # so create a temporary directory for our files instead
  5. t=$(mktemp -d -t ideone.XXXXXXXXXXXX) || exit
  6. trap 'rm -rf "$t"' ERR EXIT
  7. cd "$t"
  8.  
  9. cat <<\: >command1
  10. #!/bin/sh
  11. date >cmd1.out
  12. :
  13.  
  14. cat <<\: >command2
  15. date >cmd2.out
  16. :
  17.  
  18. # ideone disallows chmod +x so we run with sh commandX instead
  19. nohup sh ./command1 &
  20. nohup sh ./command2 &
  21.  
  22. wait
  23.  
  24. tail *.out
  25.  
Success #stdin #stdout 0.02s 5520KB
stdin
Standard input is empty
stdout
==> cmd1.out <==
Fri 20 Oct 2023 12:42:35 PM UTC

==> cmd2.out <==
Fri 20 Oct 2023 12:42:35 PM UTC