xterm - howto lauch an xterm into a specific directory
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
xterm - howto lauch an xterm into a specific directory
hello,
I would like to launch an xterm from my file manager, I'm able to get the directory but not to launch an xterm prompting at this directory... you know ?
should not be so geeky, I will be shamy
thanks in advance
PS: in the same kind of idea, how can I launch something as a specific user into a root owned script ?
When you open an xterm window, you are effectively logging in. Therefore an xterm session will always start at your home directory. You can use expect:
(http://expect.nist.gov/)
to pass commands to the xterm session after you start it. Changing to your desired directory after you have launched xterm would be covered by this.
Originally posted by idaho When you open an xterm window, you are effectively logging in. Therefore an xterm session will always start at your home directory. You can use expect
I have found another tip, not perfect but does the trick for me
Code:
#!/bin/bash
clic=$@
if [ -d $clic ]; then
dir=$clic
else
dir="`dirname \"$clic\"`/"
fi
xterm -e "cd $dir && sudo su $USER" &
my shell is a sub-shell of another but I don't care (the parent kill itself instantly when I come back on it)
Quote:
Originally posted by idaho
To run a root owned script as a non root user you can use sudo: http://www.courtesan.com/sudo/
It was the inverse I wanted, but I've found !
Code:
echo user: $USER
su -c 'echo user: $USER' jobano
That does the trick,
thanks, you were quick, that's nice !
I'm trying to do something similar, that is, running a command automatically after launching an xterm window using the 'e' switch. Something like:
xterm -e "ls"
The problem is that this causes the xterm window to run the command and get destroyed, that is, the command prompt is not available. But when I run the command
xterm -e "ls && sudo su"
the window stays open and xterm's command prompt is available for further use. But this is not what I want.
How do I get the window to stay open and also get the command prompt available (the 'hold' switch does the former, but not the latter)?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.