- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell 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
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
06-25-2004 09:16 AM
06-25-2004 09:16 AM
Shell Script
I need to write a shell script, (in vi), I have to put line feed or carage return character within the script.
Basically the purpose is not to have interaction with the user (replies), whereas go on the default behaviour.
I just need to put "ENTER" 7 times in my script, which character should I use, either I have to write, decimal, octal or hexadeciaml.
Can't work, you people help will highly be appreciated.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2004 09:30 AM
06-25-2004 09:30 AM
Re: Shell Script
Note the the echo command normally terminates with a LF unless you specifically override this behavior by ending the echo command with "\c"
To emit a single CR use "\r" followed by "\c"
e.g.
echo "\r\c"
because normally CR's are converted to NL's (you can determine this by doing a stty -a to see if icrnl is set) you can choose to either send a string of CR's or simply (and more conveniently use echo's without \c to emit the NL's for you.
About as simple as it gets is
echo "\n\n\n\n\n\n"
That will emit 7 NL's (the 6 explicit + the 1 implicit because we did not end the command with "\c".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2004 09:50 AM
06-25-2004 09:50 AM
Re: Shell Script
With vi, to enter a literal carriage return or linefeed into a text file, use the key sequence: control-V control-M
for carriage return.
use control-V control-J
for linefeed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2004 12:13 AM
06-26-2004 12:13 AM
Re: Shell Script
Just add:
read
in your script as many times you want your script to wait for
This will wait till the user hit's Enter key.
If you want to add Carraige Return without anybodies intervention then just add:
echo "\n"
as many time you want in your script.
That should work.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2004 03:25 AM
06-26-2004 03:25 AM
Re: Shell Script
Also
echo "CTRL+V+M" >>filename #Kornshell am not sure if it works in posix
Kaps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2004 01:04 AM
06-28-2004 01:04 AM
Re: Shell Script
The solutions echo "\n\n\n" works.
Thanks again for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2004 01:14 AM
06-28-2004 01:14 AM
Re: Shell Script
Nice to see that your problem got solved. I think you are new to forum, go thr' the link below about assigning points to the replies you got.
http://forums1.itrc.hp.com/service/forums/helptips.do?admit=716493758+1085211538437+28353475#33
All the best.
Keep forumming.
Regards,