HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Scripts and If
Operating System - Linux
1828890
Members
2378
Online
109985
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
05-31-2006 02:00 AM
05-31-2006 02:00 AM
Why does the following script fragment not work?
if [ $# -eq 0 ]
then
echo "No file name entered "
exit
else
echo "ok"
endif
If I run this, I get the error
Syntax error: `if' is not matched. every time.
Is it just me being exceedingly thick??
Ian Warner
if [ $# -eq 0 ]
then
echo "No file name entered "
exit
else
echo "ok"
endif
If I run this, I get the error
Syntax error: `if' is not matched. every time.
Is it just me being exceedingly thick??
Ian Warner
Why did anyone invent unix?
Solved! Go to Solution.
- Tags:
- if
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2006 02:02 AM
05-31-2006 02:02 AM
Re: Scripts and If
Ian,
IF loop ends with fi
if [ $# -eq 0 ]
then
echo "No file name entered "
exit
else
fi
IF loop ends with fi
if [ $# -eq 0 ]
then
echo "No file name entered "
exit
else
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2006 02:03 AM
05-31-2006 02:03 AM
Solution
Hi,
it depends which shell you're running.
See also:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1026132
and for the options:
http://www.context-switch.com/reference/kshref/ch4.html
HTH
Volkmar
it depends which shell you're running.
See also:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1026132
and for the options:
http://www.context-switch.com/reference/kshref/ch4.html
HTH
Volkmar
*** Say 'Thanks' with Kudos ***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2006 02:08 AM
05-31-2006 02:08 AM
Re: Scripts and If
Thank you,
I will put it down to me being thick.
Ian
I will put it down to me being thick.
Ian
Why did anyone invent unix?
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP