Timeline for exit a script if an ls line did not find any match
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 15, 2014 at 6:10 | answer | added | mikeserv | timeline score: 0 | |
| Aug 14, 2014 at 22:54 | answer | added | Gilles 'SO- stop being evil' | timeline score: 1 | |
| Aug 14, 2014 at 2:36 | comment | added | area51 |
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
|
|
| S Aug 14, 2014 at 2:34 | history | suggested | drs | CC BY-SA 3.0 |
Removed cruft
|
| Aug 14, 2014 at 2:33 | comment | added | jordanm |
Why do you have a requirement that if statements can't be used? Can you use other conditional operators such as ||?
|
|
| Aug 14, 2014 at 2:30 | comment | added | Ramesh | 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. | |
| Aug 14, 2014 at 2:26 | review | Suggested edits | |||
| S Aug 14, 2014 at 2:34 | |||||
| Aug 14, 2014 at 2:24 | review | First posts | |||
| Aug 14, 2014 at 2:26 | |||||
| Aug 14, 2014 at 2:20 | history | asked | area51 | CC BY-SA 3.0 |