- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- help_for script
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-07-2010 04:23 AM
тАО01-07-2010 04:23 AM
I wrote one script to print the first 5 numbers
I want to modify this script in such a way that
it should display 1 and then replace 1 with 2 and so on.Its just like a stop watch.
#
echo "assigning value"
Value=1
while ((Value <= 5))
do
echo $Value
((Value=Value+1))
done
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2010 04:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2010 10:01 PM
тАО01-07-2010 10:01 PM
Re: help_for script
Its working fine...
can u tell me what "\b\c" will do ?
: )
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2010 10:05 PM
тАО01-07-2010 10:05 PM
Re: help_for script
man echo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2010 10:08 PM
тАО01-07-2010 10:08 PM
Re: help_for script
>> can u tell me what "\b\c" will do ?
\c instructs command not to perform a carriage return after the out-put.
\b is for backspace
This is how the line will not change (\c) and the number will be over-written (\b).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2010 10:20 PM
тАО01-07-2010 10:20 PM
Re: help_for script
When it comes to two digits ...its not displaying properly.when it reached two digits its displaying in one line.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2010 11:03 PM
тАО01-07-2010 11:03 PM
Re: help_for script
> displaying properly. [...]
Yes, one backspace character will not move
the cursor back two places. You might try
using two backspace characters in that case.
Have you ever used a typewriter? The
concepts here are similar.
> I wrote one script to print the first 5
> numbers
If you describe the actual problem which you
are trying to solve, then you may get better
(more appropriate) answers. Otherwise, if
you're the only one who knows what the actual
problem is, then you may need to do some
thinking for yourself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-08-2010 12:44 AM
тАО01-08-2010 12:44 AM
Re: help_for script
Please help me to print first 25 numbers.
Thanks & Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-08-2010 01:17 AM
тАО01-08-2010 01:17 AM
Re: help_for script
If the digits are at the beginning, you can use "\r" for a carriage return.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-08-2010 03:04 AM
тАО01-08-2010 03:04 AM
Re: help_for script
Little Interactive and edit as per Dennis:
# cat timer
#!/usr/bin/sh
echo "Enter a number for counting: \c"
read N
Value=1
while ((Value <= $N))
do
echo "${Value}\r\c" # use "r" here
sleep 1
((Value=Value+1))
done
echo
Thanks JRF and Dennis...a good learing for me as well :-)