- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- LS on sh versus ksh
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-13-2005 12:16 AM
тАО07-13-2005 12:16 AM
I've a script in sh like:
for file in $(ls $DESTDIR_APT/{200mm,300mm}/*.{tdf,dat,ADF,EOK,LOT} 2>/dev/null)
do
compress -f $file
done
How can I do it in ksh?
Thks,
Pedro
Solved! Go to Solution.
- Tags:
- pattern
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2005 12:18 AM
тАО07-13-2005 12:18 AM
Re: LS on sh versus ksh
do
compress $FILE
done
No big changes - I did add some backticks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2005 12:29 AM
тАО07-13-2005 12:29 AM
Re: LS on sh versus ksh
:(
It doesn't work that way..I want to ls all *.tdf *.dat *.ADF *.EOK *.LOT from both directories 200mm and 300mm
Thks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2005 12:53 AM
тАО07-13-2005 12:53 AM
SolutionThis should work:
for file in $(ls ${DESTDIR_APT}/+(200mm|300mm)/*\.+(tdf|dat|ADF|EOK|LOT) 2>/dev/null)
do
echo "File: ${file}"
#compress -f ${file}
done
The "+(pattern1|pattern2)" expression requires that at least one match be found.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2005 12:54 AM
тАО07-13-2005 12:54 AM
Re: LS on sh versus ksh
for file in $(ls $DESTDIR_APT/+(200mm|300mm)/*.+(tdf|dat|ADF|EOK|LOT) 2>/dev/null)
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2005 12:59 AM
тАО07-13-2005 12:59 AM
Re: LS on sh versus ksh
Thank you all.
Pedro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2005 12:51 AM
тАО07-14-2005 12:51 AM
Re: LS on sh versus ksh
But from what I've read (and used) of ksh on different platforms, I thought it understood both the back-tick method of subshells (var=`command`) as well as the bourn-$() style of inline subshell (var=$(command)).
But all that being said, the korn shell should also be able to survive without the 'ls' at all, and do direct shell expansion of the path, i.e.
for file in $DESTDIR_APT/{2,3}00mm/*.{tdf,dat,ADF,EOK,LOT}
do
but that assumes there will always be atleast one match ;)