LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 04-11-2013, 01:15 AM   #1
manalisharmabe
Member
 
Registered: Dec 2010
Posts: 242

Rep: Reputation: 1
"su -i user1" not working


Hi all,



System is Solaris10



There is one script which i was able to execute with following entry:-

Code:
 su  user1 -c "/u01/scripts/mfg/_db-start.all"


But when I do this, which asked to do with -i option



Code:
 su -i user1 -c "/u01/scripts/mfg/_db-start.all"
It gives following message:-

Code:
Usage: su [-] [ username [ arg ... ] ]


I searched a lot but I don't know meaning of "-i" option here, what is its meaning?



Thanks,

Manali
 
Old 04-11-2013, 01:34 AM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Not -i. Just a dash.
Code:
su - user1 -c "somecommand"
The first paragraph from my su man page.

Code:
       The su command is used to become another user during a login session.
       Invoked without a username, su defaults to becoming the superuser. The
       optional argument - may be used to provide an environment similar to
       what the user would expect had the user logged in directly.
Since you thought [-] was -i perhaps you should change your system font to one that allows you to better differentiate characters. Square brackets are usually used to highlight optional arguments that aren't required for command completion. For instance, su can run without any arguments.

Last edited by sag47; 04-12-2013 at 12:18 AM.
 
1 members found this post helpful.
Old 04-16-2013, 11:58 AM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
su user1 -c "/u01/scripts/mfg/_db-start.all"
It will not change working directory to user's home, but will keep the same where you're currently in. So run the cmd as:
Code:
~# su - user1 -c "/u01/scripts/mfg/_db-start.all"
Also check manual for the su cmd here.
 
1 members found this post helpful.
Old 04-17-2013, 08:52 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
As per sag47, its a question of getting the target env setup, not which dir it ends up in.
 
1 members found this post helpful.
Old 04-26-2013, 09:55 AM   #5
manalisharmabe
Member
 
Registered: Dec 2010
Posts: 242

Original Poster
Rep: Reputation: 1
Solved. there is no such option like su -i on solaris 10 but yes u can use sudo -i
 
Old 04-26-2013, 10:15 AM   #6
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
man pages solve all. Some commands have different options depending on the platform even if the command has the same binary name. Look to your man pages to read and understand their synopsis.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache "access_log" not created. "CustomLog" not working senthilvael Linux - Server 2 09-29-2011 06:49 AM
My "expect" script is not working... Won't "send" commands... edomingox Programming 4 04-02-2009 03:25 PM
net working eth0 eth1 wlan0 "no connection" "no LAN" "no wi-fi" Cayitano Linux - Newbie 5 12-09-2007 07:11 PM
Symlinks working from "inside" 'chroot' to "outside" ? amn Linux - Newbie 2 12-07-2007 01:09 AM
commands "init" and "modprobe" not working Diagmato Fedora 2 07-22-2005 11:44 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 08:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration