1826916 Members
3207 Online
109705 Solutions
New Discussion

Help script HP-UX

 
Fernando Jose P de Souz
Regular Advisor

Help script HP-UX

Hi,

output command:

ls -tr /var/opt/ignite/recovery/archives/PJHPXC01 | grep 20
2008-07-10,12:11
2008-07-10,13:00
2008-07-10,14:00

i would like to send the output of this command and after i choose which file will be delete.

The script is attached.

wait

2 REPLIES 2
Peter Nikitka
Honored Contributor

Re: Help script HP-UX

Ok,

you have a script for your task.
- Do you want general comments?
One of me:
NUM_LINES1=`ls -tr $CAM1 | grep 20 | wc -w`
Change to
NUM_LINES1=$(ls -tr $CAM1/*20* 2>/dev/null | wc -w)
or
NUM_LINES1=$(ls -tr $CAM1 | fgrep -c 20)
or ...

- Does it not work generally?
- Does it not work under certain conditions?

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Dennis Handly
Acclaimed Contributor

Re: Help script HP-UX

Over and over in your script you are doing that ls -tr, grep and wc. You can make this much easier by using select. In my case:
select file in $( ls -tr | grep 303 ) ; do
echo $file
break
done

Here is what I get, I then enter that "5".
1) 303471.log
2) 303595.i
3) 303595.incl
4) 303595.i.incl
5) 303750.i
6) 303879.txt
#? 5
303750.i