- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Terminal losing carriage-return under "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
12-21-2004 08:09 PM
12-21-2004 08:09 PM
ls -1 > /dev/pts/20
All fine. Now, if I run "script" on the pts/20 terminal such that it's recording a typescript, the next time I do the ls command above, the carriage-returns aren't displayed. So the output on the destination screen is like: -
file1
file2
file3
file4 etc...
I know this echoing won't be recorded in the typescript, I'm not bothered about that. I just want the echoes to look correct on a terminal that's under a "script" session.
Any ideas why this is happening, and how I can overcome it?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2004 08:19 PM
12-21-2004 08:19 PM
Re: Terminal losing carriage-return under "script"?
Workaround is to pipe the output through ux2dos before redirecting.
Still interested to know _why_ it behaves this way, though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2004 01:05 AM
12-22-2004 01:05 AM
Re: Terminal losing carriage-return under "script"?
I'm trying this:
1. On command line:
#tty
/dev/pts/0
#ls -1 > /dev/pts/0
file1
file2
....
2. Using script:
#vi ./script
a=`tty`
ls -1 > $a
#chmod +x ./script
#./script
file1
file2
....
The output is the same.Where is the problem?
Regards, Stan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2004 02:03 AM
12-23-2004 02:03 AM
Re: Terminal losing carriage-return under "script"?
To reproduce:
# tty
/dev/pts/17
# script
Script started, file is typescript
# ls -1 > /dev/pts/17
file1
file2
file3
file4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2004 02:04 AM
12-23-2004 02:04 AM
Re: Terminal losing carriage-return under "script"?
file1
____file2
_________file3
______________fil4
(the underscores are blanks)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2004 04:29 AM
12-23-2004 04:29 AM
Re: Terminal losing carriage-return under "script"?
The output of the ls command has each line terminated by a LF, your stty settings translate a LF to a LF+CR. When you write to the device 'raw' like you are doing, within a script, the terminal running the script is no longer following its stty settings and doesn't do the translation. I don't know whether I explained that very well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2004 02:05 PM
12-23-2004 02:05 PM
SolutionThe stty command changes the device driver rules (see man stty and man termio) so it makes more sense. For instance, you type: text CR, but without a LF supplied automatically by the driver, all commands would be on 1 line.
So as you've discovered, ux2dos will translate LF to CR LF.
Bill Hassell, sysadmin