- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Posix Scripting question
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
01-18-2005 01:18 AM
01-18-2005 01:18 AM
while loop
read file
ask question
process if yes
done
I tried the following but it failed to work
while read
ask question
process if yes
done
the ask question(read) was answered by the shell. Any suggestions.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2005 01:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2005 03:17 AM
01-18-2005 03:17 AM
Re: Posix Scripting question
any other suggestions? (below is the code snippet
*******************************
cat deletelist.txt|while read -r userid passwd comment
do
echo "Do you wish to process $userid on $1 - password is $passwd and comments are
$comment? \c"
read response
case $response in
[y,Y,yes,YES])
echo " $userid was processed "
;;
[n,N,no,NO])
echo " $userid was not processed "
;;
*)
echo " Assuming no was the intended response "
echo " You typed $response "
echo " $userid was not processed"
;;
esac
done
**********************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2005 04:17 AM
01-18-2005 04:17 AM
Re: Posix Scripting question
xx=1
cat filename|while read -r var1 var2
do
arr1[xx]=var1
arr2[xx]=var2
let "xx = xx +1"
done
xx=1
cont=yes
while [ cont = yes ]
do
if ! [ ${var1[xx]} ]
then
cont=no
break
fi
askquestion
read
case
.....
esac
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2005 05:16 AM
01-18-2005 05:16 AM
Re: Posix Scripting question
while true
do
echo "Ask the question, or x to exit. \c"
read answer
case $answer in
0) do something;;
1) do something;;
2) do something
x) exit0
esac
done
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2005 05:46 AM
01-18-2005 05:46 AM
Re: Posix Scripting question
To have read, read from the terminal, try-
read answer <&2
Assuming STDERR is still assigned to your terminal.
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2005 03:32 AM
01-19-2005 03:32 AM
Re: Posix Scripting question
example:
exec 3< $SOME_INPUT_FILE
while read -u3 a1 a2 a3 garbage
do
print "$a3"
done
Good luck.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2005 06:28 AM
01-19-2005 06:28 AM