In bash, how can I print the first n elements of a list?
bash
n
For example, the first 10 files in this list:
FILES=$(ls)
echo $FILES | awk '{for (i = 1; i <= 10; i++) {print $i}}'
Edit: AAh, missed your comment that you needed them on one line...
echo $FILES | awk '{for (i = 1; i <= 10; i++) {printf "%s ", $i}}'
That one does that.