- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: need help with script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2007 12:18 PM
тАО07-17-2007 12:18 PM
I need a SH script that will convert all files in a directory from .ps to .pdf and then delete .ps files
The command i use for converting files is ps2pdf14 -r600 file.ps
Thanks for help. 10 points will be assigned!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2007 01:18 PM
тАО07-17-2007 01:18 PM
Solutionmanually confirm the counts for .ps and .pdf and make sure they are same
run the rm in a for loop
for i in `cat ps.list`
do
conversion command
rcode=echo $?
if [ rcode=0 ]
then
##rm $i
fi
done.
Script check the return code of conversion.Run the rm later after manual verification; to be in safe side.
- Tags:
- for loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2007 01:53 PM
тАО07-17-2007 01:53 PM
Re: need help with script
but i have a question
what does this `cat ps.list` do? i mean i don't have any ps.list file. In a directory there is just a bunch of .ps files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2007 02:52 PM
тАО07-17-2007 02:52 PM
Re: need help with script
I was going to suggest that cat shouldn't be used but it seems that Santhosh left out a step of ls *.ps? Besides fixing it, we can improve it:
for i in $(ls *.ps); do
- Tags:
- evil cat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2007 03:00 PM
тАО07-17-2007 03:00 PM
Re: need help with script
#!/usr/bin/sh
ls -1
do
ps2pdf14 -r600 $file && rm $file
done
- Tags:
- while loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2007 10:32 PM
тАО07-17-2007 10:32 PM