- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Linux shell scripting
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
Forums
Discussions
Discussions
Discussions
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
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-14-2005 10:59 PM
07-14-2005 10:59 PM
Linux shell scripting
How is it possible to make it into a nested "if' statement or if there is such a thing.
Does anyone else have any idea how to make this a better script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2005 11:05 PM
07-14-2005 11:05 PM
Re: Linux shell scripting
if [ condition ]
then
if [ nextcondition ]
then
if [ anothercondition ]
then
code
fi
fi
fi
Or in-line:
if [ condition -a nextcondition -a anothercondition ]
then
code
fi
Or perhaps you'd prefer a case:
case value in
value1) code ;;
value2) code ;;
*) defaultcode ;;
esac
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2005 11:25 PM
07-14-2005 11:25 PM
Re: Linux shell scripting
case is ideal for these kind of situation.
if that is not possible you can use if-elif-fi
eg:
if
then
elif
then
else
fi
Regards,
Gopi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2005 06:58 PM
07-15-2005 06:58 PM
Re: Linux shell scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2005 07:01 PM
07-15-2005 07:01 PM
Re: Linux shell scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2005 07:50 PM
07-15-2005 07:50 PM
Re: Linux shell scripting
steve,
for that matter i indeed repeated stuart's suggestion :)
if you are not able to see the replies, then raise it as an issue to moderators
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2005 12:28 AM
07-16-2005 12:28 AM
Re: Linux shell scripting
-Ross