Advertisement
NadaBupkis

timing test

Feb 4th, 2023 (edited)
968
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.38 KB | None | 0 0
  1. #!/opt/homebrew/bin/bash
  2.  
  3. # with curly braces
  4. test1 () {
  5.     for ((x=0; x< 30000; x++)) {
  6.     echo "foo" | { read bar && echo "$bar" >/dev/null; }
  7.     }
  8. }
  9.  
  10. # with parens
  11. test2 () {
  12.     for ((x=0; x< 30000; x++)) {
  13.     echo "foo" | ( read bar && echo "$bar" > /dev/null )
  14.     }
  15. }
  16.  
  17. echo "Compound command with curly brackets"
  18. time test1
  19. echo "Compound command with parens"
  20. time test2
Tags: BASH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement