Q: Bash Script Positioning I'm really new to bash scripting, so I don't know much. What I want to do is open over 100k xclocks and scatter them randomly across the screen (it's just for fun, not malicious intent). I have the xclock commands inserted, but they all open in one spot on the screen.
So, how do I get all 100k clocks to randomly disperse about the screen?
Code so far (really basic):
#! \bin\bash
xclock &

This goes on for 100k lines. 

A: This use xrandr or xdpyinfo to detect screen resolution:
#!/bin/bash

if [[ -x $(which xrandr) ]]; then
  res=$(xrandr | awk '/\*/ {print $1}')
else
  if [[ -x $(which xdpyinfo) ]]; then
    res=$(xdpyinfo | awk '/dimensions/ {print $2}')
  else
    echo "Can not detect screen resolution"
    exit 1
  fi
fi

x=${res%x*}; y=${res#*x}
for i in {1..100}; do xclock -geometry 120x120+$(($RANDOM%$x-120))+$(($RANDOM%$y-120)) & done

