Try this instead, which is more or less equivalent to the C code:
Code:
#!/bin/bash
 
my_string="123rte"
yes $my_string | head -n 10000 | awk '{ print $1 }' > /dev/null 2>&1