Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • You can certainly do it and I see a way as seen from here. stackoverflow.com/a/3068942/1742825. However, you need to add more details so that it can be modified to suit your requirements. Commented Aug 14, 2014 at 2:30
  • 3
    Why do you have a requirement that if statements can't be used? Can you use other conditional operators such as ||? Commented Aug 14, 2014 at 2:33
  • yeah, I can use double pipe I tried this ls -lrt /dir1/dir2/filename*.txt | tail -1 | awk '{print $9}' | read variable || echo "exiting..."; exit but it doesn't work Commented Aug 14, 2014 at 2:36