DalHorinek
asked on
screen running shell with another rc file
Hi, I have special configuration file for bash in some cases.
bash --noprofile --rc-file .mybashrc (I don't want to load the default one)
So I have s script where I run the command above.
But when I run a screen, it runs bash with default rc files and profile one.
so i tried to pass to screen as -s the script calling bash with rc file, but screen terminates immediately, no error thrown.
One last idea I have is merge my configs and direct loding based on some environment variable or so.
Are there other options?
bash --noprofile --rc-file .mybashrc (I don't want to load the default one)
So I have s script where I run the command above.
But when I run a screen, it runs bash with default rc files and profile one.
so i tried to pass to screen as -s the script calling bash with rc file, but screen terminates immediately, no error thrown.
One last idea I have is merge my configs and direct loding based on some environment variable or so.
Are there other options?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I stand corrected, -s does not take an argument. Still, it should be --rcfile, not --rc-file.
Gremwell, the --rc-file option is indeed incorrect.
From the man page:
--rcfile file
Execute commands from file instead of the standard personal initialization file ~/.bashrc if the shell is interactive (see INVOCATION below).
From the man page:
--rcfile file
Execute commands from file instead of the standard personal initialization file ~/.bashrc if the shell is interactive (see INVOCATION below).
ASKER
I'm sorry for confusing by rc-file, sure it's rcfile.
gremwell, thanks, your way is working ok, that's what I tried, but I had an error somewhere, don't know where, and screen immediately terminated.
Now it's ok.
pvzweden
screen -s -- /bin/bash --noprofile --rcfile .mybashrc
Actually doesn't work, cuz it says Cannot exec '-': No such file or directory, because -s needs an argument, so it takes the following - (i don't know what it does with the other one - ) :)
Anyway thank you.
gremwell, thanks, your way is working ok, that's what I tried, but I had an error somewhere, don't know where, and screen immediately terminated.
Now it's ok.
pvzweden
screen -s -- /bin/bash --noprofile --rcfile .mybashrc
Actually doesn't work, cuz it says Cannot exec '-': No such file or directory, because -s needs an argument, so it takes the following - (i don't know what it does with the other one - ) :)
Anyway thank you.
Try: screen -s -- bash --noprofile --rc-file .mybashrc
You need to place the -s option last. The "--" tells the command line it's the last option that is being given to the "screen" command.
Other option would indeed be to edit the default bashrc that get's called from your homedir to make a choice based on a profile option.
Patrick