- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- about loop
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
тАО01-02-2005 03:28 AM
тАО01-02-2005 03:28 AM
about loop
Iam new in script
I create a simple script to list all files and directory in current dir
*********
for i in *
if [ -d $i ]
then
echo $i "Directory"
fi
------> I wnant to go next i and esc the next
(what command i put here to do that?)
echo $i
done
********************
thankx
kamal
- Tags:
- for loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-02-2005 03:51 AM
тАО01-02-2005 03:51 AM
Re: about loop
Do I understand you correct ?
Something like:
for i in *
do
if [ -d $i ]
then
echo $i "Directory"
else
echo $i "File"
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-02-2005 04:07 AM
тАО01-02-2005 04:07 AM
Re: about loop
that is true in this example
but
in other case
if i want to esc the next lines and continue
next i
is there any way to do that ?
thankx
- Tags:
- continue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-02-2005 04:48 AM
тАО01-02-2005 04:48 AM
Re: about loop
Could you please describe more in detail.
Which "lines" do you want to esc (skip ?) ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-02-2005 04:56 AM
тАО01-02-2005 04:56 AM
Re: about loop
perhaps this is what you are looking for:
for i in *
if [ -d $i ]
then
echo $i "Directory"
fi
continue
echo $i
done
the code is not very useful but you might learn somthing by that.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-02-2005 05:32 AM
тАО01-02-2005 05:32 AM
Re: about loop
if any one familer with visual basic
*********************************************
for x = 1 to 10
if (any condition) then
(do any thing)
next x ---> (this command return to x again without complete the next lines ).
end if
(any thing)
next
********************************************
i want to know what is this command in unix ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-02-2005 07:55 PM
тАО01-02-2005 07:55 PM
Re: about loop
I can give you two examples that will do the same job as the example in basic. Example two is a "direct" translation but the syntax in example 1 should be prefered.
for i in 1 2 3 4 5 6 7 8 9 10
do
if [ (any condition) ]
then
(do something)
else
(do something else)
fi
done
for i in 1 2 3 4 5 6 7 8 9 10
do
if [ (any condition) ]
then
(do something)
continue
fi
(do something else)
done
for x = 1 to 10
if (any condition) then
(do any thing)
next x ---> (this command return to x again without complete the next lines ).
end if
(any thing)
next