- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: non-displayable characters returned using "su ...
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
тАО02-22-2010 02:25 PM
тАО02-22-2010 02:25 PM
non-displayable characters returned using "su - logonid -c string"
su - patrol -c "/usr/bin/which PatrolAgent"|grep PatrolAgent|cat -vet
returns:
^M^[[3g^M ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H ^[H^M/application/patrol/3.6/PatrolAgent$
I need to just get the path and program name. I have tried various combinations using 'tr' but still am having trouble:
su - patrol -c "/usr/bin/which PatrolAgent"|grep PatrolAgent|tr -cd "[:alnum:]"
gets me:
3gHHHHHHHHHHHHHHHHHapplicationpatrol36PatrolAgent
so that's no good. Any thoughts on another way to extract the contents of the which command?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2010 02:47 PM
тАО02-22-2010 02:47 PM
Re: non-displayable characters returned using "su - logonid -c string"
Don't use 'su -' which causes your profile to be sourced (read). Instead use:
# su patrol -c "..."
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2010 04:46 PM
тАО02-22-2010 04:46 PM
Re: non-displayable characters returned using "su - logonid -c string"
You could try the following:
su patrol -c '. ~patrol/.profile;/usr/bin/which PatrolAgent'
This will execute the .profile without setting up a whole new environment.
NB: White space between "." and "~patrol"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2010 06:46 PM
тАО02-22-2010 06:46 PM
Re: non-displayable characters returned using "su - logonid -c string"
However, the non-printable characters are emitted by the "tabs" command.... which is probably present in the user's .profile to set up the terminal's tab-stops for interactive working.
Try commenting out the "tabs" line in the .profile
This may cause unexpected behaviour if the user logs in to an interactive session.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2010 07:46 PM
тАО02-22-2010 07:46 PM
Re: non-displayable characters returned using "su - logonid -c string"
> .profile
Or making it conditional on talking to a real
terminal. (What does "tty" say in this
environment?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2010 06:20 AM
тАО02-23-2010 06:20 AM
Re: non-displayable characters returned using "su - logonid -c string"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2010 06:21 AM
тАО02-23-2010 06:21 AM
Re: non-displayable characters returned using "su - logonid -c string"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2010 07:02 AM
тАО02-23-2010 07:02 AM