xim 247 B

123456
  1. #!/bin/sh
  2. if [ -r "$1" ]; then
  3. ls -1 | awk -v file="$1" 'BEGIN { lines = ""; m = 0; } $0 ~ file { m = 1; } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }' | sxiv -fi
  4. else
  5. sxiv -ft *
  6. fi