5

Read 2 lines from File, Run Command based off output

view full story
linux-howto

http://www.unix.com – Okay, so I have a file containing line after line of three digit numbers. I need a script that does an action based on the last two numbers in this list. So.... To get the last two numbers, I can have the script do tail -2 filename.txt But where I run into trouble is as follows. If these last two numbers, retrieved via tail, are Greater than 400, I want to run a command. The command is irrelevant, so lets just make something up: touch filename.txt If it helps, it doesnt necessarily have to do > 400. It would still meet my needs if it did something more like. If = 400 or 401 (HowTos)