The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

Start an app using non-interactive shell

asked 2013-03-05 10:43:29 +0000

lzap gravatar image

updated 2013-03-05 10:44:18 +0000

Hello,

I am using i3 for some time and I am happy. Today I have discovered one interesting thing - I have a script i3/autostart which I start using the following method:

exec ~/.i3/autostart

The script has /bin/sh shebang, because I do not want to load up my environment at this point. And my $SHELL variable is /bin/bash of course.

Now there is one issue, because i3 tries to load using $SHELL or /bin/sh. I do have my shell set to bash (I use Bash as the main shell), but I want to autostart via /bin/sh (or bash --norc - that is the same thing). And I think I am unable to do it. I am thinking about a workaround, but can't find anything.

The issue I have is I am not able to completely exit the environment, e.g. when I close my terminal and I want to start over with freshly modified .bashrc, I can't do it, because my new forked shell will inherit all the variables from this ueber-shell.

Also when I do things like

PATH=$PATH:/xyz/xyz

it is added twice then.

Do you know about any solution? Thanks.

edit retag flag offensive close merge delete

Comments

Why do you set the SHELL environment variable to bash when all you need is an entry in /etc/passwd to make bash the login shell for your user account?

Michael gravatar imageMichael ( 2013-03-05 10:52:09 +0000 )edit

I dont set it of course, I just mean it is set to /bin/bash (but I am not setting it).

lzap gravatar imagelzap ( 2013-03-05 11:32:48 +0000 )edit

Then set it to /bin/sh explicitly?

Michael gravatar imageMichael ( 2013-03-06 14:00:32 +0000 )edit

This is strange, something is not correct and I don't know what. I need to investigate if bash -c parameter reads my profile or not.

lzap gravatar imagelzap ( 2013-03-06 14:56:06 +0000 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-03-06 15:09:48 +0000

lzap gravatar image

Ok I think I need to fix my bash profiles :-)

http://www.gnu.org/software/bash/manu...

I had everything in my .bashrc file while I want to setup PATHs and that kind of stuff only in .bash_profile :-)

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-03-05 10:43:29 +0000

Seen: 616 times

Last updated: Mar 06 '13