- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to write su in 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
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
тАО11-24-2010 06:28 AM
тАО11-24-2010 06:28 AM
how to write su in shell script
kindly find the step to find the license status
sudo su - kumar
cd /home/kumar/lic
lmstat lic |more
Question
kindly help how to write this script in my
login
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2010 06:35 AM
тАО11-24-2010 06:35 AM
Re: how to write su in shell script
vi script
#!/bin/ksh
sudo su - kumar
cd /home/kumar/lic
lmstat lic |more
:wq!
chmod 755 script
Now run it
./script
Shibin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2010 07:22 AM
тАО11-24-2010 07:22 AM
Re: how to write su in shell script
find the output
rajesh &./lic
(c)Copyright 1983-2000 Hewlett-Packard Co., All Rights Reserved.
(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 Novell, Inc.
(c)Copyright 1986-1992 Sun Microsystems, Inc.
(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology
(c)Copyright 1989-1993 The Open Software Foundation, Inc.
(c)Copyright 1986 Digital Equipment Corp.
(c)Copyright 1990 Motorola, Inc.
(c)Copyright 1990, 1991, 1992 Cornell University
(c)Copyright 1989-1991 The University of Maryland
(c)Copyright 1988 Carnegie Mellon University
(c)Copyright 1991-2000 Mentat Inc.
(c)Copyright 1996 Morning Star Technologies, Inc.
&
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2010 07:33 AM
тАО11-24-2010 07:33 AM
Re: how to write su in shell script
you may have to specify the path.
whereis lmstat or find / -name 'lmstat*'
Then add that path to above script and try.
Shibin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2010 08:05 AM
тАО11-24-2010 08:05 AM
Re: how to write su in shell script
sudo su - kumar -----1st line
more /home/kumar/lic/lmstat lic |more -----2nd line
tha above mentioned script after 1st line excuted successfully ,but 2nd line not excuted after the put ctrl+d then it shows you cannot able to access the cd /home/kumar/lic/lmstat file.
output
rajesh&./lic
after login session
kumar& (script stuck)
ctrl+d
/home/kumar/lic/lmstat : not found.
rajesh$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2010 08:14 AM
тАО11-24-2010 08:14 AM
Re: how to write su in shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2010 08:17 AM
тАО11-24-2010 08:17 AM
Re: how to write su in shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2010 04:30 PM
тАО11-24-2010 04:30 PM
Re: how to write su in shell script
Does it ask for a password for:
sudo su - kumar -c "id"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2010 10:57 PM
тАО11-24-2010 10:57 PM
Re: how to write su in shell script
You have many unassigned responses.
127 of 315 responses to my questions.
Encourage the valuable Replies with approprtate points.
Thanks & Regards
Jayakrishnan G Naik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-25-2010 04:37 AM
тАО11-25-2010 04:37 AM
Re: how to write su in shell script
Sorry, it will not happen in future.
After this command
output
sudo su - kumar -c "id"
Password:
kindly help to sort out this issue