- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script 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
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
тАО08-07-2003 08:24 AM
тАО08-07-2003 08:24 AM
Script Question
Example:
echo "This is a test\n\n" > /tmp/testing
Of course this resulted in the file having two blank lines after the sentence. I tried to use \\n\\n to no avail. I attempted to use sed, again to no avail.
How can I echo \n into a file and have it mean \n and not newline?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2003 08:32 AM
тАО08-07-2003 08:32 AM
Re: Script Question
echo "This is a test" > /tmp/testing
echo "" >> /tmp/testing
echo "" >> /tmp/testing
The above will "This is a test and then append 2 blank lines to the file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2003 08:34 AM
тАО08-07-2003 08:34 AM
Re: Script Question
# echo "\\\n"
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2003 08:40 AM
тАО08-07-2003 08:40 AM
Re: Script Question
Rgds,
Jean-Luc
PS : single quote !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-07-2003 09:06 AM
тАО08-07-2003 09:06 AM
Re: Script Question
\\ you need to type two backslashes for a backslash
print test\\\\n
caution \ is a quote character and the shell will remove it when it expands the command, unless the \ is quoted
print 'test\\n'
and the easiest way would be to use print with the -r switch. -r, the shell does not use the \ conventions.
print -r "test\n"