- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script help
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
02-12-2006 10:02 AM
02-12-2006 10:02 AM
I am using the following two lines in one of my script
Enter user name
read NAME
I want to stop entering null value. If someone enters enter without giving character then i want to echo a warning.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2006 10:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2006 12:54 PM
02-12-2006 12:54 PM
Re: script help
How about:
/mnt/root # cat x
#!/bin/sh
a=""
while [ "${a}" = "" ]
do
echo -n "Please enter name : "
read a
done
echo "---> $a <----"
Please be sure to check some basic shell programming books of web pages.
Pretty much the very question you asked is answerred in one that popped up with google: +unix +sh +while:
http://steve-parker.org/sh/loops.shtml
hth,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2006 04:45 PM
02-12-2006 04:45 PM
Re: script help
echo "Enter User Name"
read NAME
if [[ -z ${NAME} ]]
then
echo "User name is null. Enter it."
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2006 04:51 PM
02-12-2006 04:51 PM
Re: script help
read NAME
while [ NAME = "" ]
do
echo -n "Its null, Enter a Name: "
read a
done
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2006 08:07 PM
02-14-2006 08:07 PM
Re: script help
read NAME"?Enter user name "
if [[ -z $NAME ]] ; then
echo "you must enter something"
fi
HTH,
Art