Hi,
I've put two commands in bashrc but only one of them will execute.
How can we execute both?
- cd /home/user/Desktop
- sudo -i
Hi,
I've put two commands in bashrc but only one of them will execute.
How can we execute both?
- cd /home/user/Desktop
- sudo -i
What exactly are you trying to achieve? Putting sudo -i in your .bashrc file sounds like a TERRIBLE idea to me
FWIW it almost certainly IS executing both commands - however 'sudo -i' changes to root's home directory (/root) immediately negating the previous 'cd'
They probably are both executing but the -i in makes the new shell with the same settings as if it were a fresh login. So that overrides the previous cd. Try it without the -i, unless there is a specific reason you have it.
Thanks for the answers.
I'm trying to open terminal as root.
Without -i it just spits out the options and with -s it freezes up.
Try using it to launch a shell instead.
Or are you talking about launching the graphical terminal?Code:cd /home/user/Desktop sudo /bin/bash
Code:gksudo "gnome-terminal --working-directory=/home/user/Desktop"
No, thanks, was talking about command line.
sudo /bin/bash asks for password but then it freezes up too.
It's working if I do a 'Ctrl-c' after it. Thanks!
Last edited by ubu88; December 1st, 2013 at 07:09 PM.
Try your original commands, but swap their sequence so that you do the "sudo" first. That may not work, because of the switch to root being immediate and thus cutting off access to the rest of .bashrc, but if .bashrc is executing from RAM rather than from the disk, it might do what you want. In any case, were I doing this, I would make these the final two commands in the file. And as noted above, it's a really BAD idea since it puts you in root mode every time you log in!
--
Jim Kyle in Oklahoma, USA
Linux Counter #259718
Howto mark thread: https://wiki.ubuntu.com/UnansweredPo.../SolvedThreads
Having it jump directly to root isn't the best idea. What problem are you actually trying to solve?
Bookmarks