0

I want to run a shell scipr that prints out the top 50 lines of a number of files. After the head of each file is printed, I want the script to allow the user to view that content for 10 seconds before printing out the head of the next file. E.g

head -n 50 file1
wait 10 seconds
head -n 50 file2
wait 10 seconds

and so on...

Thanks in advance for any help

0

3 Answers 3

2

Try it like this:

for f in *
do
 head -n 50 $f
 sleep 10;
done
Sign up to request clarification or add additional context in comments.

Comments

0

Use sleep within an infinite loop.

Comments

0

if you want to watch some output with $n seconds interval, use

watch -n $n <commands here>

1 Comment

The OP wants to pause between viewing different files, not view the same file repeatedly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.